/** <a href="http://www.cpupk.com/decompiler">Eclipse Class Decompiler</a> plugin, Copyright (c) 2017 Chen Chao. **/
package com.minierp.controller;

import com.minierp.bean.OrderParameterCarrier;
import com.minierp.bean.OvCountBean;
import com.minierp.bean.OvCountBeanComparator;
import com.minierp.bean.QueryParameterCarrier;
import com.minierp.bean.QueryResult;
import com.minierp.bean.UserBean;
import com.minierp.dao.BusinessBillItemDao;
import com.minierp.dao.DepartmentDao;
import com.minierp.dao.EnterpriseInfoDao;
import com.minierp.dao.IdGenerator;
import com.minierp.dao.MakeTypeDao;
import com.minierp.dao.OutputDao;
import com.minierp.dao.QueryDao;
import com.minierp.dao.SmsAlertDao;
import com.minierp.dao.StafferDao;
import com.minierp.dao.TallySetDao;
import com.minierp.dao.WorkCenterDao;
import com.minierp.dao.WorkProcessDao;
import com.minierp.err.NotAllowException;
import com.minierp.err.PermissionDennyException;
import com.minierp.helper.EncCommonHelper;
import com.minierp.helper.PageHelper;
import com.minierp.model.BusinessBill;
import com.minierp.model.BusinessBillItem;
import com.minierp.model.BusinessBillItemExt;
import com.minierp.model.EnterpriseInfo;
import com.minierp.model.OvPercent;
import com.minierp.model.SmsAlert;
import com.minierp.service.OutputService;
import com.minierp.view.OutputCountExcelView;
import com.minierp.view.OutputListExcelView;
import com.minierp.view.OvBusinessListExcelView;
import com.minierp.view.OvCountExcelView;
import com.minierp.view.OvDesignListExcelView;
import com.minierp.view.OvFollowListExcelView;
import com.minierp.view.OvMakeListExcelView;
import com.minierp.view.OvReceiveListExcelView;
import com.minierp.view.OvSaleListExcelView;
import com.minierp.view.OvSetuListExcelView;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.dao.CannotAcquireLockException;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;

public class OutputMACtr extends MultiActionController {
	private OutputDao outputDao;
	private WorkProcessDao workProcessDao;
	private WorkCenterDao workCenterDao;
	private TallySetDao tallySetDao;
	private MakeTypeDao makeTypeDao;
	private QueryDao queryDao;
	private EnterpriseInfoDao enterpriseInfoDao;
	private DepartmentDao departmentDao;
	private StafferDao stafferDao;
	private BusinessBillItemDao businessBillItemDao;
	private SmsAlertDao smsAlertDao;
	private OutputService outputService;
	private IdGenerator idGenerator;
	private String outputFormView;
	private String outputMultiFormView;
	private String searchResultView;
	private String countView;
	private String operateSuccessView;
	private String setOvPercentFormView;
	private String ovCountView;
	private String ovBusiListView;
	private String ovMakeListView;
	private String ovReceListView;
	private String ovFollListView;
	private String ovDesiListView;
	private String ovSaleListView;
	private String ovSetuListView;

	public String getOvSetuListView() {
		return this.ovSetuListView;
	}

	public void setOvSetuListView(String ovSetuListView) {
		this.ovSetuListView = ovSetuListView;
	}

	public SmsAlertDao getSmsAlertDao() {
		return this.smsAlertDao;
	}

	public void setSmsAlertDao(SmsAlertDao smsAlertDao) {
		this.smsAlertDao = smsAlertDao;
	}

	public BusinessBillItemDao getBusinessBillItemDao() {
		return this.businessBillItemDao;
	}

	public void setBusinessBillItemDao(BusinessBillItemDao businessBillItemDao) {
		this.businessBillItemDao = businessBillItemDao;
	}

	public String getOutputMultiFormView() {
		return this.outputMultiFormView;
	}

	public void setOutputMultiFormView(String outputMultiFormView) {
		this.outputMultiFormView = outputMultiFormView;
	}

	public String getOvCountView() {
		return this.ovCountView;
	}

	public void setOvCountView(String ovCountView) {
		this.ovCountView = ovCountView;
	}

	public String getOvBusiListView() {
		return this.ovBusiListView;
	}

	public void setOvBusiListView(String ovBusiListView) {
		this.ovBusiListView = ovBusiListView;
	}

	public String getOvMakeListView() {
		return this.ovMakeListView;
	}

	public void setOvMakeListView(String ovMakeListView) {
		this.ovMakeListView = ovMakeListView;
	}

	public String getOvReceListView() {
		return this.ovReceListView;
	}

	public void setOvReceListView(String ovReceListView) {
		this.ovReceListView = ovReceListView;
	}

	public String getOvFollListView() {
		return this.ovFollListView;
	}

	public void setOvFollListView(String ovFollListView) {
		this.ovFollListView = ovFollListView;
	}

	public String getOvDesiListView() {
		return this.ovDesiListView;
	}

	public void setOvDesiListView(String ovDesiListView) {
		this.ovDesiListView = ovDesiListView;
	}

	public String getOvSaleListView() {
		return this.ovSaleListView;
	}

	public void setOvSaleListView(String ovSaleListView) {
		this.ovSaleListView = ovSaleListView;
	}

	public ModelAndView handleOutputForm(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.outputFormView);
		String itemIdStr = request.getParameter("item_id_str");
		String wcId = request.getParameter("wc_id");
		String proId = request.getParameter("pro_id");
		String alertType = request.getParameter("alert_type");
		SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
		String makeDate = sf.format(new Date());
		mv.addObject("proList",
				this.workProcessDao.getList(Long.parseLong(wcId), true));
		mv.addObject("wcId", wcId);
		mv.addObject("proId", proId);
		mv.addObject("itemIdStr", itemIdStr);
		mv.addObject("makeDate", makeDate);
		mv.addObject("percent", "1");
		mv.addObject("alertType", alertType);
		return mv;
	}

	public ModelAndView handleOutputMultiForm(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.outputMultiFormView);
		String itemId = request.getParameter("item_id");
		String wcId = request.getParameter("wc_id");
		String idStr = request.getParameter("id_str");
		String nameStr = request.getParameter("name_str");
		String fromType = request.getParameter("from_type");
		String proId = request.getParameter("pro_id");
		SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
		String makeDate = sf.format(new Date());
		mv.addObject("proList",
				this.workProcessDao.getList(Long.parseLong(wcId), true));
		mv.addObject("wcId", wcId);
		mv.addObject("itemId", itemId);
		mv.addObject(
				"bbItem",
				this.workProcessDao.get(BusinessBillItemExt.class,
						Long.parseLong(itemId)));
		mv.addObject("makeDate", makeDate);
		mv.addObject("idList", idStr.split(";"));
		mv.addObject("nameList", nameStr.split(";"));
		mv.addObject("fromType", fromType);
		mv.addObject("proId", proId);
		if (idStr.indexOf(";") == -1) {
			mv.addObject("perList", new String[]{"1"});
		}

		return mv;
	}

	public ModelAndView handleOutputNew(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String itemIdStr = request.getParameter("item_id_str");
		String wcId = request.getParameter("wc_id");
		String proId = request.getParameter("pro_id");
		String makerId = request.getParameter("maker_id");
		String makerName = request.getParameter("maker_name");
		String makeDateStr = request.getParameter("make_date");
		String percentStr = request.getParameter("percent");
		String mark = request.getParameter("mark");
		String comp = request.getParameter("comp");
		String continueFlag = request.getParameter("continue_flag");
		String errMsg = "";
		if (makerId != null && !makerId.equals("") && !makerId.equals("0")) {
			if (proId == null || proId.equals("") || proId.equals("0")) {
				errMsg = "请选择『工序』";
			}
		} else {
			errMsg = "请选择『制作人』";
		}

		BigDecimal percent = new BigDecimal(0);
		BigDecimal zero = new BigDecimal(0);
		BigDecimal one = new BigDecimal(1);
		if (errMsg.equals("")) {
			try {
				percent = new BigDecimal(percentStr);
			} catch (Exception arg35) {
				errMsg = "『工序产量占比』只能输入数字";
			}
		}

		if (errMsg.equals("")
				&& (percent.compareTo(zero) <= 0 || percent.compareTo(one) > 0)) {
			errMsg = "『工序产量占比』不能大于1或小于等于0";
		}

		Date makeDate = null;
		if (errMsg.equals("")) {
			try {
				SimpleDateFormat mv = new SimpleDateFormat("yyyy-MM-dd");
				makeDate = mv.parse(makeDateStr);
			} catch (Exception arg34) {
				errMsg = "『制作日期』输入错误。格式：2011-01-01";
			}
		}

		if (errMsg.equals("")) {
			EnterpriseInfo arg38 = EncCommonHelper.getEnterpriseInfo(request);
			boolean saProComp = false;
			boolean saFolComp = false;
			boolean saBusComp = false;
			SmsAlert sa = this.smsAlertDao.get("PRO_COMP");
			if (sa != null && sa.getStatus() != null
					&& sa.getStatus().equals("Y")) {
				saProComp = true;
			}

			sa = this.smsAlertDao.get("FOL_COMP");
			Object saFolRecList = new ArrayList();
			if (sa != null && sa.getStatus() != null
					&& sa.getStatus().equals("Y")) {
				saFolComp = true;
				saFolRecList = this.smsAlertDao.getReceiverList(sa.getId());
			}

			sa = this.smsAlertDao.get("BUS_COMPLETE");
			String customTxt = "";
			if (sa != null && sa.getStatus() != null
					&& sa.getStatus().equals("Y")) {
				saBusComp = true;
				customTxt = sa.getCustomTxt();
			}

			List processList = this.workProcessDao.getList(
					Long.parseLong(wcId), false);
			List mtList = this.makeTypeDao.getList(false);

			try {
				UserBean w = EncCommonHelper.getCurrentUserAccount(request);
				String[] idArr = itemIdStr.split(";");

				for (int i = 0; i < idArr.length; ++i) {
					Map map = this.outputService.txInsert(
							Long.parseLong(idArr[i]), Long.parseLong(proId),
							Long.parseLong(makerId), makerName, percent,
							makeDate, mark, w, processList, mtList, comp,
							this.outputDao, this.businessBillItemDao,
							this.idGenerator);
					if (map.get("proMsg") != null) {
						try {
							if (saProComp) {
								PageHelper.sendProCompMsg(map, mtList, w,
										this.stafferDao, this.idGenerator);
							}
						} catch (Exception arg33) {
							arg33.printStackTrace();
						}
					}

					if (map.get("comp") != null) {
						try {
							if (saFolComp) {
								PageHelper.sendFolCompMsg(map, w,
										(List) saFolRecList, this.stafferDao,
										this.idGenerator);
							}
						} catch (Exception arg32) {
							arg32.printStackTrace();
						}

						try {
							if (saBusComp) {
								PageHelper.sendBusCompSms(map, customTxt,
										arg38.getShortName(), this.stafferDao,
										this.idGenerator);
							}
						} catch (Exception arg31) {
							arg31.printStackTrace();
						}
					}
				}
			} catch (NotAllowException arg36) {
				errMsg = arg36.getMessage();
			} catch (CannotAcquireLockException arg37) {
				errMsg = "事务冲突故障，请重新操作！";
			}
		}

		ModelAndView arg39;
		if (errMsg.equals("")) {
			if (continueFlag != null && continueFlag.equals("1")) {
				arg39 = new ModelAndView(this.outputFormView);
				arg39.addObject("proList",
						this.workProcessDao.getList(Long.parseLong(wcId), true));
				arg39.addObject("wcId", wcId);
				arg39.addObject("proId", proId);
				arg39.addObject("itemIdStr", itemIdStr);
				arg39.addObject("percent", "1");
				arg39.addObject("makeDate", makeDateStr);
				EncCommonHelper.setAlertMessage(request, "保存成功！");
				return arg39;
			} else {
				arg39 = new ModelAndView(this.operateSuccessView);
				arg39.addObject("returnValue", "ok");
				EncCommonHelper.setAlertMessage(request, "保存成功！");
				return arg39;
			}
		} else {
			arg39 = new ModelAndView(this.outputFormView);
			arg39.addObject("proList",
					this.workProcessDao.getList(Long.parseLong(wcId), true));
			arg39.addObject("wcId", wcId);
			arg39.addObject("proId", proId);
			arg39.addObject("itemIdStr", itemIdStr);
			arg39.addObject("percent", percentStr);
			arg39.addObject("makeDate", makeDateStr);
			arg39.addObject("makerId", makerId);
			arg39.addObject("makerName", makerName);
			arg39.addObject("mark", mark);
			EncCommonHelper.setAlertMessage(request, errMsg);
			return arg39;
		}
	}

	public ModelAndView handleOutputMultiNew(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String itemId = request.getParameter("item_id");
		String wcId = request.getParameter("wc_id");
		String proId = request.getParameter("pro_id");
		String makeDateStr = request.getParameter("make_date");
		int makerNum = Integer.parseInt(request.getParameter("maker_num"));
		String continueFlag = request.getParameter("continue_flag");
		String comp = request.getParameter("comp");
		String fromType = request.getParameter("from_type");
		String errMsg = "";
		if (proId == null || proId.equals("") || proId.equals("0")) {
			errMsg = "请选择『工序』";
		}

		Date makeDate = null;
		if (errMsg.equals("")) {
			try {
				SimpleDateFormat percent = new SimpleDateFormat("yyyy-MM-dd");
				makeDate = percent.parse(makeDateStr);
			} catch (Exception arg36) {
				errMsg = "『制作日期』输入错误。格式：2011-01-01";
			}
		}

		BigDecimal arg38 = new BigDecimal(0);
		BigDecimal zero = new BigDecimal(0);
		BigDecimal one = new BigDecimal(1);
		BigDecimal perTotal = new BigDecimal(0);
		ArrayList idArr = new ArrayList();
		ArrayList nameArr = new ArrayList();
		ArrayList perArr = new ArrayList();

		int mv;
		for (mv = 0; mv < makerNum; ++mv) {
			perArr.add(request.getParameter("percent_" + mv));
			idArr.add(request.getParameter("id_" + mv));
			nameArr.add(request.getParameter("name_" + mv));
		}

		if (errMsg.equals("")) {
			for (mv = 0; mv < makerNum; ++mv) {
				try {
					arg38 = new BigDecimal(perArr.get(mv).toString());
				} catch (Exception arg37) {
					errMsg = "『工序产量占比』只能输入数字";
					break;
				}

				if (arg38.compareTo(zero) < 0 || arg38.compareTo(one) > 0) {
					errMsg = "『工序产量占比』不能大于1或小于0";
					break;
				}

				perTotal = perTotal.add(arg38);
			}
		}

		if (errMsg.equals("") && arg38.compareTo(one) > 0) {
			errMsg = "所有工序产量占比总和不能超过1";
		}

		if (errMsg.equals("")) {
			UserBean arg39 = EncCommonHelper.getCurrentUserAccount(request);
			EnterpriseInfo ent = EncCommonHelper.getEnterpriseInfo(request);
			List processList = this.workProcessDao.getList(
					Long.parseLong(wcId), false);
			List mtList = this.makeTypeDao.getList(false);
			boolean saProComp = false;
			boolean saFolComp = false;
			boolean saBusComp = false;
			SmsAlert sa = this.smsAlertDao.get("PRO_COMP");
			if (sa != null && sa.getStatus() != null
					&& sa.getStatus().equals("Y")) {
				saProComp = true;
			}

			sa = this.smsAlertDao.get("FOL_COMP");
			Object saFolRecList = new ArrayList();
			if (sa != null && sa.getStatus() != null
					&& sa.getStatus().equals("Y")) {
				saFolComp = true;
				saFolRecList = this.smsAlertDao.getReceiverList(sa.getId());
			}

			sa = this.smsAlertDao.get("BUS_COMPLETE");
			String customTxt = "";
			if (sa != null && sa.getStatus() != null
					&& sa.getStatus().equals("Y")) {
				saBusComp = true;
				customTxt = sa.getCustomTxt();
			}

			try {
				Map w = this.outputService.txInsert(Long.parseLong(itemId),
						Long.parseLong(proId), idArr, nameArr, perArr,
						makeDate, arg39, processList, mtList, comp,
						this.outputDao, this.businessBillItemDao,
						this.idGenerator);
				if (w.get("proMsg") != null) {
					try {
						if (saProComp) {
							PageHelper.sendProCompMsg(w, mtList, arg39,
									this.stafferDao, this.idGenerator);
						}
					} catch (Exception arg33) {
						arg33.printStackTrace();
					}
				}

				if (w.get("comp") != null) {
					try {
						if (saFolComp) {
							PageHelper.sendFolCompMsg(w, arg39,
									(List) saFolRecList, this.stafferDao,
									this.idGenerator);
						}
					} catch (Exception arg32) {
						arg32.printStackTrace();
					}

					try {
						if (saBusComp) {
							PageHelper.sendBusCompSms(w, customTxt,
									ent.getShortName(), this.stafferDao,
									this.idGenerator);
						}
					} catch (Exception arg31) {
						arg31.printStackTrace();
					}
				}
			} catch (NotAllowException arg34) {
				errMsg = arg34.getMessage();
			} catch (CannotAcquireLockException arg35) {
				errMsg = "事务冲突故障，请重新操作！";
			}
		}

		ModelAndView arg40;
		if (errMsg.equals("")) {
			if (continueFlag != null && continueFlag.equals("1")) {
				arg40 = new ModelAndView(this.outputMultiFormView);
				arg40.addObject("proList",
						this.workProcessDao.getList(Long.parseLong(wcId), true));
				arg40.addObject("wcId", wcId);
				arg40.addObject("itemId", itemId);
				arg40.addObject(
						"bbItem",
						this.workProcessDao.get(BusinessBillItem.class,
								Long.parseLong(itemId)));
				arg40.addObject("makeDate", makeDateStr);
				arg40.addObject("idList", idArr);
				arg40.addObject("nameList", nameArr);
				arg40.addObject("fromType", fromType);
				if (idArr.size() == 1) {
					arg40.addObject("perList", new String[]{"1"});
				}

				EncCommonHelper.setAlertMessage(request, "保存成功！");
				return arg40;
			} else {
				arg40 = new ModelAndView(this.operateSuccessView);
				arg40.addObject("returnValue", "ok");
				EncCommonHelper.setAlertMessage(request, "保存成功！");
				return arg40;
			}
		} else {
			arg40 = new ModelAndView(this.outputMultiFormView);
			arg40.addObject("proList",
					this.workProcessDao.getList(Long.parseLong(wcId), true));
			arg40.addObject("wcId", wcId);
			arg40.addObject("proId", proId);
			arg40.addObject("itemId", itemId);
			arg40.addObject(
					"bbItem",
					this.workProcessDao.get(BusinessBillItem.class,
							Long.parseLong(itemId)));
			arg40.addObject("perList", perArr);
			arg40.addObject("makeDate", makeDateStr);
			arg40.addObject("idList", idArr);
			arg40.addObject("nameList", nameArr);
			arg40.addObject("fromType", fromType);
			EncCommonHelper.setAlertMessage(request, errMsg);
			return arg40;
		}
	}

	public ModelAndView handleDelete(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String retUrl = request.getParameter("from_url");
		String wcId = request.getParameter("wc_id");
		String id = request.getParameter("id");
		ModelAndView mv = new ModelAndView("redirect:" + retUrl);
		String msg = "";
		List processList = this.workProcessDao.getList(Long.parseLong(wcId),
				false);

		try {
			msg = this.outputService.txDelete(Long.parseLong(id), processList,
					this.outputDao,
					EncCommonHelper.getCurrentUserAccount(request));
		} catch (CannotAcquireLockException arg9) {
			msg = "事务冲突故障，请重新操作！";
		}

		EncCommonHelper.setAlertMessage(request, msg);
		return mv;
	}

	public ModelAndView handleSearchResult(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "OUTP_SEAR")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			EnterpriseInfo ent = EncCommonHelper.getEnterpriseInfo(request);
			String billObjName = "com.minierp.model.BusinessBill";
			String billObjShortName = "b";
			String beObjName = "com.minierp.model.BusinessBillExt";
			String beObjShortName = "be";
			String itemObjName = "com.minierp.model.BusinessBillItem";
			String itemObjShortName = "i";
			String estObjName = "com.minierp.model.Establishment";
			String estObjShortName = "e";
			String outObjName = "com.minierp.model.Output";
			String outObjShortName = "o";
			HashMap shortNameMap = new HashMap();
			String[] retObjs = new String[]{"o", "i", "b.billCode",
					"e.estName", "be.completed", "b.linkman"};
			Vector qpVe = new Vector();
			HashMap parameters = new HashMap();
			shortNameMap.put(billObjName, billObjShortName);
			shortNameMap.put(beObjName, beObjShortName);
			shortNameMap.put(itemObjName, itemObjShortName);
			shortNameMap.put(estObjName, estObjShortName);
			shortNameMap.put(outObjName, outObjShortName);
			QueryParameterCarrier qp = new QueryParameterCarrier();
			qp.objectName = billObjName;
			qp.propertyName = "id";
			qp.value = " b.id=be.id";
			qp.dataType = 6;
			qp.logicType = 10;
			qpVe.add(qp);
			qp = new QueryParameterCarrier();
			qp.objectName = billObjName;
			qp.propertyName = "id";
			qp.value = " b.id=i.billId";
			qp.dataType = 6;
			qp.logicType = 10;
			qpVe.add(qp);
			qp = new QueryParameterCarrier();
			qp.objectName = billObjName;
			qp.propertyName = "clientId";
			qp.value = " b.clientId=e.id";
			qp.dataType = 6;
			qp.logicType = 10;
			qpVe.add(qp);
			qp = new QueryParameterCarrier();
			qp.objectName = itemObjName;
			qp.propertyName = "id";
			qp.value = " i.id=o.bbItemId";
			qp.dataType = 6;
			qp.logicType = 10;
			qpVe.add(qp);
			qp = new QueryParameterCarrier();
			qp.objectName = beObjName;
			qp.propertyName = "enabled";
			qp.value = " be.enabled=\'Y\'";
			qp.dataType = 6;
			qp.logicType = 10;
			qpVe.add(qp);
			if (EncCommonHelper.checkPurePrivilege(request, "OUTP_SELF")) {
				qp = new QueryParameterCarrier();
				qp.objectName = itemObjName;
				qp.propertyName = "makerId";
				qp.value = " o.makerId=" + ub.getStaffer().getId();
				qp.dataType = 6;
				qp.logicType = 10;
				qpVe.add(qp);
			}

			if (EncCommonHelper.checkPurePrivilege(request, "BUSI_SELF")) {
				qp = new QueryParameterCarrier();
				qp.objectName = estObjName;
				qp.propertyName = "managerId";
				qp.value = " e.managerId=" + ub.getStaffer().getId();
				qp.dataType = 6;
				qp.logicType = 10;
				qpVe.add(qp);
			}

			Date now = new Date();
			SimpleDateFormat shortSf = new SimpleDateFormat("yyyy-MM");
			SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
			Date allowStart = null;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
				allowStart = EncCommonHelper.getEarlDataDate(request);
				qp = new QueryParameterCarrier();
				qp.objectName = billObjName;
				qp.propertyName = "orderDate";
				qp.value = sf.format(allowStart);
				qp.dataType = 4;
				qp.logicType = 5;
				qpVe.add(qp);
			}

			String searchType = request.getParameter("search_type");
			String startDate = request.getParameter("start_date");
			String endDate = request.getParameter("end_date");
			String wcId = request.getParameter("wc_id");
			String bbCode = request.getParameter("bb_code");
			String content = request.getParameter("content");
			String makerName = request.getParameter("maker_name");
			String mtId = request.getParameter("mt_id");
			String tsId = request.getParameter("ts_id");
			String fiCont = request.getParameter("fi_cont");
			String proName = request.getParameter("pro_name");
			String depId = request.getParameter("dep_id");
			String qParas;
			String p1;
			String contentType;
			if (searchType != null && !searchType.equals("")) {
				if (searchType.equals("2")) {
					qp = new QueryParameterCarrier();
					qp.objectName = outObjName;
					qp.propertyName = "makeDate";
					qp.value = startDate;
					qp.dataType = 4;
					qp.logicType = 5;
					qpVe.add(qp);
					qp = new QueryParameterCarrier();
					qp.objectName = outObjName;
					qp.propertyName = "makeDate";
					qp.value = EncCommonHelper.getNextDateStr(endDate,
							"yyyy-MM-dd");
					qp.dataType = 4;
					qp.logicType = 2;
					qpVe.add(qp);
					qParas = "";
					if (ent.getWorkCenter().equals("Y")) {
						qParas = EncCommonHelper.createWcSQLStr("i.wcId", ub,
								false);
					}

					if (qParas != null && !qParas.equals("")) {
						qp = new QueryParameterCarrier();
						qp.objectName = itemObjName;
						qp.propertyName = "wcId";
						qp.value = qParas;
						qp.dataType = 6;
						qp.logicType = 10;
						qpVe.add(qp);
					}

					p1 = EncCommonHelper.createTallySetSQLStr("b.tallySetId",
							ub, false);
					if (p1 != null && !p1.equals("")) {
						qp = new QueryParameterCarrier();
						qp.objectName = billObjName;
						qp.propertyName = "tallySetId";
						qp.value = p1;
						qp.dataType = 6;
						qp.logicType = 10;
						qpVe.add(qp);
					}
				} else {
					qParas = request.getParameter("cb_make_date");
					p1 = request.getParameter("cb_maker");
					String p2 = request.getParameter("cb_wc");
					String qr = request.getParameter("cb_cont");
					contentType = request.getParameter("cb_bb_code");
					String mv = request.getParameter("cb_ts");
					String curPage = request.getParameter("cb_mt");
					String pageSize = request.getParameter("cb_fi");
					String cbPro = request.getParameter("cb_pro");
					String cbDep = request.getParameter("cb_dep");
					String staObjName;
					if (p2 != null && p2.equals("1")) {
						qp = new QueryParameterCarrier();
						qp.objectName = itemObjName;
						qp.propertyName = "wcId";
						qp.value = " i.wcId=" + wcId;
						qp.dataType = 6;
						qp.logicType = 10;
						qpVe.add(qp);
						parameters.put("cbWc", p2);
					} else {
						staObjName = "";
						if (ent.getWorkCenter().equals("Y")) {
							staObjName = EncCommonHelper.createWcSQLStr(
									"i.wcId", ub, false);
						}

						if (staObjName != null && !staObjName.equals("")) {
							qp = new QueryParameterCarrier();
							qp.objectName = itemObjName;
							qp.propertyName = "wcId";
							qp.value = staObjName;
							qp.dataType = 6;
							qp.logicType = 10;
							qpVe.add(qp);
						}
					}

					if (mv != null && mv.equals("1")) {
						qp = new QueryParameterCarrier();
						qp.objectName = billObjName;
						qp.propertyName = "tallySetId";
						qp.value = " b.tallySetId=" + tsId;
						qp.dataType = 6;
						qp.logicType = 10;
						qpVe.add(qp);
						parameters.put("cbTs", mv);
					} else {
						staObjName = EncCommonHelper.createTallySetSQLStr(
								"b.tallySetId", ub, false);
						if (staObjName != null && !staObjName.equals("")) {
							qp = new QueryParameterCarrier();
							qp.objectName = billObjName;
							qp.propertyName = "tallySetId";
							qp.value = staObjName;
							qp.dataType = 6;
							qp.logicType = 10;
							qpVe.add(qp);
						}
					}

					if (qParas != null && qParas.equals("1")) {
						qp = new QueryParameterCarrier();
						qp.objectName = outObjName;
						qp.propertyName = "makeDate";
						qp.value = startDate;
						qp.dataType = 4;
						qp.logicType = 5;
						qpVe.add(qp);
						qp = new QueryParameterCarrier();
						qp.objectName = outObjName;
						qp.propertyName = "makeDate";
						qp.value = EncCommonHelper.getNextDateStr(endDate,
								"yyyy-MM-dd");
						qp.dataType = 4;
						qp.logicType = 2;
						qpVe.add(qp);
						parameters.put("cbMakeDate", qParas);
					}

					if (contentType != null && contentType.equals("1")) {
						qp = new QueryParameterCarrier();
						qp.objectName = billObjName;
						qp.propertyName = "billCode";
						qp.value = bbCode;
						qp.dataType = 1;
						qp.logicType = 9;
						qpVe.add(qp);
						parameters.put("cbBbCode", contentType);
					}

					if (p1 != null && p1.equals("1")) {
						qp = new QueryParameterCarrier();
						qp.objectName = outObjName;
						qp.propertyName = "makerName";
						qp.value = makerName;
						qp.dataType = 1;
						qp.logicType = 9;
						qpVe.add(qp);
						parameters.put("cbMaker", p1);
					}

					if (qr != null && qr.equals("1")) {
						qp = new QueryParameterCarrier();
						qp.objectName = billObjName;
						qp.propertyName = "content";
						qp.value = content;
						qp.dataType = 1;
						qp.logicType = 9;
						qpVe.add(qp);
						parameters.put("cbCont", qr);
					}

					if (curPage != null && curPage.equals("1")) {
						qp = new QueryParameterCarrier();
						qp.objectName = itemObjName;
						qp.propertyName = "makeTypeId";
						qp.value = " i.makeTypeId=" + mtId;
						qp.dataType = 6;
						qp.logicType = 10;
						qpVe.add(qp);
						parameters.put("cbMt", curPage);
					}

					if (pageSize != null && pageSize.equals("1")) {
						qp = new QueryParameterCarrier();
						qp.objectName = itemObjName;
						qp.propertyName = "finishedContent";
						qp.value = fiCont;
						qp.dataType = 1;
						qp.logicType = 9;
						qpVe.add(qp);
						parameters.put("cbFi", pageSize);
					}

					if (cbPro != null && cbPro.equals("1")) {
						qp = new QueryParameterCarrier();
						qp.objectName = itemObjName;
						qp.propertyName = "proName";
						qp.value = proName;
						qp.dataType = 1;
						qp.logicType = 9;
						qpVe.add(qp);
						parameters.put("cbPro", cbPro);
					}

					if (cbDep != null && cbDep.equals("1")) {
						staObjName = "com.minierp.model.Staffer";
						String staObjShortName = "s";
						String depObjName = "com.minierp.model.Department";
						String depObjShortName = "d";
						shortNameMap.put(staObjName, staObjShortName);
						shortNameMap.put(depObjName, depObjShortName);
						qp = new QueryParameterCarrier();
						qp.objectName = outObjName;
						qp.propertyName = "makerId";
						qp.value = " o.makerId=s.id";
						qp.dataType = 6;
						qp.logicType = 10;
						qpVe.add(qp);
						qp = new QueryParameterCarrier();
						qp.objectName = staObjName;
						qp.propertyName = "departmentId";
						qp.value = " s.departmentId=d.id";
						qp.dataType = 6;
						qp.logicType = 10;
						qpVe.add(qp);
						qp = new QueryParameterCarrier();
						qp.objectName = depObjName;
						qp.propertyName = "id";
						qp.value = " (d.id=" + depId
								+ " or (d.parentIdStr like \'%;" + depId
								+ ";%\'))";
						qp.dataType = 6;
						qp.logicType = 10;
						qpVe.add(qp);
						parameters.put("cbDep", cbDep);
					}
				}
			} else {
				searchType = "2";
				startDate = shortSf.format(now) + "-01";
				endDate = sf.format(now);
				qp = new QueryParameterCarrier();
				qp.objectName = outObjName;
				qp.propertyName = "makeDate";
				qp.value = startDate;
				qp.dataType = 4;
				qp.logicType = 5;
				qpVe.add(qp);
				qp = new QueryParameterCarrier();
				qp.objectName = outObjName;
				qp.propertyName = "makeDate";
				qp.value = EncCommonHelper
						.getNextDateStr(endDate, "yyyy-MM-dd");
				qp.dataType = 4;
				qp.logicType = 2;
				qpVe.add(qp);
				qParas = "";
				if (ent.getWorkCenter().equals("Y")) {
					qParas = EncCommonHelper
							.createWcSQLStr("i.wcId", ub, false);
				}

				if (qParas != null && !qParas.equals("")) {
					qp = new QueryParameterCarrier();
					qp.objectName = itemObjName;
					qp.propertyName = "wcId";
					qp.value = qParas;
					qp.dataType = 6;
					qp.logicType = 10;
					qpVe.add(qp);
				}

				p1 = EncCommonHelper.createTallySetSQLStr("b.tallySetId", ub,
						false);
				if (p1 != null && !p1.equals("")) {
					qp = new QueryParameterCarrier();
					qp.objectName = billObjName;
					qp.propertyName = "tallySetId";
					qp.value = p1;
					qp.dataType = 6;
					qp.logicType = 10;
					qpVe.add(qp);
				}
			}

			QueryParameterCarrier[] arg51 = new QueryParameterCarrier[qpVe
					.size()];

			for (int arg50 = 0; arg50 < qpVe.size(); ++arg50) {
				arg51[arg50] = (QueryParameterCarrier) qpVe.get(arg50);
			}

			OrderParameterCarrier arg53 = new OrderParameterCarrier();
			arg53.objectName = outObjName;
			arg53.propertyName = "makeDate";
			arg53.orderTarget = "desc";
			OrderParameterCarrier arg52 = new OrderParameterCarrier();
			arg52.objectName = outObjName;
			arg52.propertyName = "id";
			arg52.orderTarget = "desc";
			OrderParameterCarrier[] oParas = new OrderParameterCarrier[]{arg53,
					arg52};
			parameters.put("searchType", searchType);
			parameters.put("startDate", startDate);
			parameters.put("endDate", endDate);
			parameters.put("bbCode", bbCode);
			parameters.put("tsId", tsId);
			parameters.put("wcId", wcId);
			parameters.put("content", content);
			parameters.put("mtId", mtId);
			parameters.put("makerName", makerName);
			parameters.put("fiCont", fiCont);
			parameters.put("proName", proName);
			parameters.put("depId", depId);
			contentType = request.getParameter("content_type");
			QueryResult arg54;
			if (contentType != null && contentType.equals("EXCEL")) {
				arg54 = this.queryDao.doQuery(arg51, oParas, (String[]) null,
						shortNameMap, retObjs, (String[]) null);
				OutputListExcelView arg56 = new OutputListExcelView();
				HashMap arg58 = new HashMap();
				arg58.put("list", arg54.getList());
				arg58.put("workCenterList", this.workCenterDao.getList(false));
				arg58.put("makeTypeList", this.makeTypeDao.getList(false));
				arg58.put("processList", this.workProcessDao.getList(0L, false));
				return new ModelAndView(arg56, arg58);
			} else {
				ModelAndView arg55 = new ModelAndView(this.searchResultView);
				int arg57 = EncCommonHelper.getCurrentPageIndex(request);
				int arg59 = EncCommonHelper.getPageSize(request);
				arg54 = this.queryDao
						.doQuery(arg57, arg59, arg51, oParas, (String[]) null,
								shortNameMap, retObjs, (String[]) null);
				arg55.addAllObjects(parameters);
				arg55.addObject("qr", arg54);
				arg55.addObject("tsList",
						PageHelper.getTallySetList(this.tallySetDao, ub));
				arg55.addObject("wcList", PageHelper.getWorkCenterList(
						this.workCenterDao, ub, ent));
				arg55.addObject("workCenterList",
						this.workCenterDao.getList(false));
				arg55.addObject("makeTypeList", this.makeTypeDao.getList(false));
				arg55.addObject("processList",
						this.workProcessDao.getList(0L, false));
				arg55.addObject("depList", this.departmentDao.getList(true));
				return arg55;
			}
		}
	}

	public ModelAndView handleCount(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "OUTP_COUN")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.countView);
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			EnterpriseInfo ent = EncCommonHelper.getEnterpriseInfo(request);
			boolean selfOutput = false;
			boolean selfEst = false;
			boolean checkWc = false;
			Date allowStart = null;
			if (EncCommonHelper.checkPurePrivilege(request, "OUTP_SELF")) {
				selfOutput = true;
			}

			if (EncCommonHelper.checkPurePrivilege(request, "BUSI_SELF")) {
				selfEst = true;
			}

			if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
				allowStart = EncCommonHelper.getEarlDataDate(request);
			}

			if (ent.getWorkCenter().equals("Y")) {
				checkWc = true;
			}

			String makerName = "";
			String startDateStr = "";
			String endDateStr = "";
			long wcId = 0L;
			long proId = 0L;
			long mtId = 0L;
			long tsId = 0L;
			long depId = 0L;
			Date startDate = null;
			Date endDate = null;
			mv.addObject("startDate", request.getParameter("start_date"));
			mv.addObject("endDate", request.getParameter("end_date"));
			mv.addObject("wcId", request.getParameter("wc_id"));
			mv.addObject("proId", request.getParameter("pro_id"));
			mv.addObject("makerName", request.getParameter("maker_name"));
			mv.addObject("mtId", request.getParameter("mt_id"));
			mv.addObject("tsId", request.getParameter("ts_id"));
			mv.addObject("depId", request.getParameter("dep_id"));
			Date now = new Date();
			SimpleDateFormat shortSf = new SimpleDateFormat("yyyy-MM");
			SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
			String searchType = request.getParameter("search_type");
			String contentType;
			if (searchType != null && !searchType.equals("")) {
				if (searchType.equals("2")) {
					startDateStr = request.getParameter("start_date");
					endDateStr = request.getParameter("end_date");
					startDate = sf.parse(startDateStr);
					endDate = sf.parse(EncCommonHelper.getNextDateStr(
							endDateStr, "yyyy-MM-dd"));
				} else {
					String total = request.getParameter("cb_make_date");
					contentType = request.getParameter("cb_maker");
					String perPageNum = request.getParameter("cb_wc");
					String pageno = request.getParameter("cb_ts");
					String startIndex = request.getParameter("cb_mt");
					String list = request.getParameter("cb_dep");
					if (perPageNum != null && perPageNum.equals("1")) {
						wcId = Long.parseLong(request.getParameter("wc_id"));
						mv.addObject("cbWc", perPageNum);
						proId = Long.parseLong(request.getParameter("pro_id"));
					}

					if (pageno != null && pageno.equals("1")) {
						tsId = Long.parseLong(request.getParameter("ts_id"));
						mv.addObject("cbTs", pageno);
					}

					if (total != null && total.equals("1")) {
						startDateStr = request.getParameter("start_date");
						endDateStr = request.getParameter("end_date");
						startDate = sf.parse(startDateStr);
						endDate = sf.parse(EncCommonHelper.getNextDateStr(
								endDateStr, "yyyy-MM-dd"));
						mv.addObject("cbMakeDate", total);
					}

					if (contentType != null && contentType.equals("1")) {
						makerName = request.getParameter("maker_name");
						mv.addObject("cbMaker", contentType);
					}

					if (startIndex != null && startIndex.equals("1")) {
						mtId = Long.parseLong(request.getParameter("mt_id"));
						mv.addObject("cbMt", startIndex);
					}

					if (list != null && list.equals("1")) {
						depId = Long.parseLong(request.getParameter("dep_id"));
						mv.addObject("cbDep", list);
					}
				}
			} else {
				searchType = "2";
				startDateStr = shortSf.format(now) + "-01";
				endDateStr = sf.format(now);
				startDate = sf.parse(startDateStr);
				endDate = sf.parse(EncCommonHelper.getNextDateStr(endDateStr,
						"yyyy-MM-dd"));
				mv.addObject("startDate", startDateStr);
				mv.addObject("endDate", endDateStr);
			}

			int total1 = this.outputDao.getCountTotal(startDate, endDate, wcId,
					depId, proId, makerName, mtId, selfOutput, selfEst,
					allowStart, checkWc, tsId, ub);
			contentType = request.getParameter("content_type");
			if (contentType != null && contentType.equals("EXCEL")) {
				List perPageNum2 = this.outputDao.getCountList(startDate,
						endDate, wcId, depId, proId, makerName, mtId,
						selfOutput, selfEst, allowStart, checkWc, tsId, ub, 0,
						total1);
				OutputCountExcelView pageno2 = new OutputCountExcelView();
				HashMap startIndex2 = new HashMap();
				startIndex2.put("list", perPageNum2);
				startIndex2.put("wcList", this.workCenterDao.getList(false));
				startIndex2.put("proList",
						this.workProcessDao.getList(0L, false));
				startIndex2.put("mtList", this.makeTypeDao.getList(false));
				startIndex2.put("depList", this.departmentDao.getList(true));
				return new ModelAndView(pageno2, startIndex2);
			} else {
				int perPageNum1 = EncCommonHelper.getPageSize(request);
				int pageno1 = EncCommonHelper.getCurrentPageIndex(request,
						total1, perPageNum1);
				int startIndex1 = (pageno1 - 1) * perPageNum1;
				List list1 = this.outputDao.getCountList(startDate, endDate,
						wcId, depId, proId, makerName, mtId, selfOutput,
						selfEst, allowStart, checkWc, tsId, ub, startIndex1,
						perPageNum1);
				mv.addObject("qr", EncCommonHelper.parseQueryResult(list1,
						total1, perPageNum1, pageno1));
				mv.addObject("tsList",
						PageHelper.getTallySetList(this.tallySetDao, ub));
				mv.addObject("wcList", PageHelper.getWorkCenterList(
						this.workCenterDao, ub, ent));
				mv.addObject("workCenterList",
						this.workCenterDao.getList(false));
				mv.addObject("mtList", this.makeTypeDao.getList(true));
				mv.addObject("makeTypeList", this.makeTypeDao.getList(false));
				mv.addObject("processList",
						this.workProcessDao.getList(0L, false));
				mv.addObject("searchType", searchType);
				String tmpWcId = request.getParameter("wc_id");
				if (tmpWcId != null && !tmpWcId.equals("")
						&& !tmpWcId.equals("0")) {
					mv.addObject("proList", this.workProcessDao.getList(
							Long.parseLong(tmpWcId), true));
				}

				mv.addObject("depList", this.departmentDao.getList(true));
				return mv;
			}
		}
	}

	public ModelAndView handleSetOvPercentForm(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String billId = request.getParameter("bill_id");
		ModelAndView mv = new ModelAndView(this.setOvPercentFormView);
		if (billId != null && !billId.equals("")) {
			if (!EncCommonHelper.checkPrivilege(request, "OV_PERC_SPEC")) {
				throw new PermissionDennyException("Permission Denny");
			}

			String[] ent1 = billId.split(";");
			String billCode = "";
			if (ent1.length == 1) {
				OvPercent b = this.outputDao.getOvPercent(Long
						.parseLong(billId));
				mv.addObject("busi", b.getBusiOv());
				mv.addObject("make", b.getMakeOv());
				mv.addObject("foll", b.getFollOv());
				mv.addObject("rece", b.getReceOv());
				mv.addObject("comDesi", b.getComDesi());
				mv.addObject("cliDesi", b.getCliDesi());
				mv.addObject("setu", b.getSetuOv());
				BusinessBill b1 = (BusinessBill) this.outputDao.get(
						BusinessBill.class, Long.parseLong(ent1[0]));
				if (b1 != null) {
					billCode = b1.getBillCode();
				}
			} else if (ent1.length > 0) {
				BusinessBill b2 = (BusinessBill) this.outputDao.get(
						BusinessBill.class, Long.parseLong(ent1[0]));
				if (b2 != null) {
					billCode = b2.getBillCode() + "...";
				}
			}

			mv.addObject("billCode", billCode);
			mv.addObject("billId", billId);
		} else {
			if (!EncCommonHelper.checkPrivilege(request, "OV_PERC")) {
				throw new PermissionDennyException("Permission Denny");
			}

			EnterpriseInfo ent = this.enterpriseInfoDao.get();
			mv.addObject("busi", ent.getBusiOv());
			mv.addObject("make", ent.getMakeOv());
			mv.addObject("foll", ent.getFollOv());
			mv.addObject("rece", ent.getReceOv());
			mv.addObject("comDesi", ent.getComDesi());
			mv.addObject("cliDesi", ent.getCliDesi());
			mv.addObject("setu", ent.getSetuOv());
		}

		return mv;
	}

	public ModelAndView handleSetOvPercent(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String busi = request.getParameter("busi");
		String make = request.getParameter("make");
		String foll = request.getParameter("foll");
		String rece = request.getParameter("rece");
		String setu = request.getParameter("setu");
		String comD = request.getParameter("com_desi");
		String cliD = request.getParameter("cli_desi");
		String billId = request.getParameter("bill_id");
		BigDecimal zero = new BigDecimal(0);
		BigDecimal total = new BigDecimal(0);
		BigDecimal busiOv = new BigDecimal(0);
		BigDecimal makeOv = new BigDecimal(0);
		BigDecimal receOv = new BigDecimal(0);
		BigDecimal follOv = new BigDecimal(0);
		BigDecimal setuOv = new BigDecimal(0);
		BigDecimal comDesi = new BigDecimal(0);
		BigDecimal cliDesi = new BigDecimal(0);
		String errMsg = "";
		if (errMsg.equals("")) {
			try {
				busiOv = new BigDecimal(busi);
				total = total.add(busiOv);
				if (busiOv.compareTo(zero) < 0) {
					errMsg = "『接单产值占比』不能输入小于0的数字";
				}
			} catch (Exception arg30) {
				errMsg = "『接单产值占比』只能输入数字";
			}
		}

		if (errMsg.equals("")) {
			try {
				follOv = new BigDecimal(foll);
				total = total.add(follOv);
				if (follOv.compareTo(zero) < 0) {
					errMsg = "『跟单产值占比』不能输入小于0的数字";
				}
			} catch (Exception arg29) {
				errMsg = "『跟单产值占比』只能输入数字";
			}
		}

		if (errMsg.equals("")) {
			try {
				receOv = new BigDecimal(rece);
				total = total.add(receOv);
				if (receOv.compareTo(zero) < 0) {
					errMsg = "『收欠费产值占比』不能输入小于0的数字";
				}
			} catch (Exception arg28) {
				errMsg = "『收欠费产值占比』只能输入数字";
			}
		}

		if (errMsg.equals("")) {
			try {
				makeOv = new BigDecimal(make);
				total = total.add(makeOv);
				if (makeOv.compareTo(zero) < 0) {
					errMsg = "『制作产值占比』不能输入小于0的数字";
				}
			} catch (Exception arg27) {
				errMsg = "『制作产值占比』只能输入数字";
			}
		}

		if (errMsg.equals("")) {
			try {
				setuOv = new BigDecimal(setu);
				total = total.add(setuOv);
				if (setuOv.compareTo(zero) < 0) {
					errMsg = "『安装产值占比』不能输入小于0的数字";
				}
			} catch (Exception arg26) {
				errMsg = "『安装产值占比』只能输入数字";
			}
		}

		if (errMsg.equals("")) {
			try {
				comDesi = new BigDecimal(comD);
				total.add(comDesi);
				if (comDesi.compareTo(zero) < 0) {
					errMsg = "『设计产值占比(公司设计)』不能输入小于0的数字";
				}
			} catch (Exception arg25) {
				errMsg = "『设计产值占比(公司设计)』只能输入数字";
			}
		}

		if (errMsg.equals("")) {
			try {
				cliDesi = new BigDecimal(cliD);
				if (cliDesi.compareTo(zero) < 0) {
					errMsg = "『设计产值占比(客户来稿)』不能输入小于0的数字";
				}
			} catch (Exception arg24) {
				errMsg = "『设计产值占比(客户来稿)』只能输入数字";
			}
		}

		if (errMsg.equals("") && comDesi.compareTo(cliDesi) < 0) {
			errMsg = "客户来稿的占比不能超过公司设计的占比！";
		}

		errMsg.equals("");
		ModelAndView mv;
		if (errMsg.equals("")) {
			mv = new ModelAndView(this.operateSuccessView);
			if (billId != null && !billId.equals("")) {
				String[] arg31 = billId.split(";");

				for (int i = 0; i < arg31.length; ++i) {
					OvPercent op = this.outputDao.getOvPercent(Long
							.parseLong(arg31[i]));
					if (op != null) {
						op.setBusiOv(busiOv);
						op.setMakeOv(makeOv);
						op.setFollOv(follOv);
						op.setReceOv(receOv);
						op.setSetuOv(setuOv);
						op.setComDesi(comDesi);
						op.setCliDesi(cliDesi);
						op.setUpdated("Y");
						this.outputDao.update(op);
					}
				}
			} else {
				EnterpriseInfo idArr = this.enterpriseInfoDao.get();
				idArr.setBusiOv(busiOv);
				idArr.setMakeOv(makeOv);
				idArr.setFollOv(follOv);
				idArr.setReceOv(receOv);
				idArr.setSetuOv(setuOv);
				idArr.setComDesi(comDesi);
				idArr.setCliDesi(cliDesi);
				this.enterpriseInfoDao.update(idArr);
				EncCommonHelper.setEnterpriseInfo(request, idArr);
				mv.addObject("alertType", "SHOW");
			}

			mv.addObject("returnValue", "ok");
			EncCommonHelper.setAlertMessage(request, "保存成功");
		} else {
			mv = new ModelAndView(this.setOvPercentFormView);
			mv.addObject("busi", busi);
			mv.addObject("make", make);
			mv.addObject("foll", foll);
			mv.addObject("rece", rece);
			mv.addObject("setu", setu);
			mv.addObject("comDesi", comD);
			mv.addObject("cliDesi", cliD);
			mv.addObject("billId", billId);
			EncCommonHelper.setAlertMessage(request, errMsg);
		}

		return mv;
	}

	public ModelAndView handleOvBusiList(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "OV_BUSI")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.ovBusiListView);
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			boolean selfOutput = false;
			if (EncCommonHelper.checkPurePrivilege(request, "OUTP_SELF")) {
				selfOutput = true;
			}

			Date allowStart = null;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
				allowStart = EncCommonHelper.getEarlDataDate(request);
			}

			String startDateStr = "";
			String endDateStr = "";
			String bbCode = "";
			String cont = "";
			long depId = 0L;
			long tsId = 0L;
			long staId = 0L;
			Date startDate = null;
			Date endDate = null;
			mv.addObject("startDate", request.getParameter("start_date"));
			mv.addObject("endDate", request.getParameter("end_date"));
			mv.addObject("depId", request.getParameter("dep_id"));
			mv.addObject("staName", request.getParameter("sta_name"));
			mv.addObject("staId", request.getParameter("sta_id"));
			mv.addObject("bbCode", request.getParameter("bb_code"));
			mv.addObject("cont", request.getParameter("cont"));
			mv.addObject("tsId", request.getParameter("ts_id"));
			Date now = new Date();
			SimpleDateFormat shortSf = new SimpleDateFormat("yyyy-MM");
			SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
			String searchType = request.getParameter("search_type");
			String contentType;
			if (searchType != null && !searchType.equals("")) {
				if (searchType.equals("2")) {
					startDateStr = request.getParameter("start_date");
					endDateStr = request.getParameter("end_date");
					startDate = sf.parse(startDateStr);
					if (allowStart != null && allowStart.after(startDate)) {
						startDate = allowStart;
					}

					endDate = sf.parse(EncCommonHelper.getNextDateStr(
							endDateStr, "yyyy-MM-dd"));
				} else {
					String cl = request.getParameter("cb_date");
					String ovCost = request.getParameter("cb_sta");
					String bbCost = request.getParameter("cb_dep");
					String total = request.getParameter("cb_ts");
					contentType = request.getParameter("cb_bb_code");
					String perPageNum = request.getParameter("cb_cont");
					if (bbCost != null && bbCost.equals("1")) {
						depId = Long.parseLong(request.getParameter("dep_id"));
						mv.addObject("cbDep", bbCost);
					}

					if (total != null && total.equals("1")) {
						tsId = Long.parseLong(request.getParameter("ts_id"));
						mv.addObject("cbTs", total);
					}

					if (cl != null && cl.equals("1")) {
						startDateStr = request.getParameter("start_date");
						endDateStr = request.getParameter("end_date");
						startDate = sf.parse(startDateStr);
						if (allowStart != null && allowStart.after(startDate)) {
							startDate = allowStart;
						}

						endDate = sf.parse(EncCommonHelper.getNextDateStr(
								endDateStr, "yyyy-MM-dd"));
						mv.addObject("cbDate", cl);
					} else {
						startDate = allowStart;
					}

					if (ovCost != null && ovCost.equals("1")) {
						staId = Long.parseLong(request.getParameter("sta_id"));
						mv.addObject("cbSta", ovCost);
					}

					if (contentType != null && contentType.equals("1")) {
						bbCode = request.getParameter("bb_code");
						mv.addObject("cbBbCode", contentType);
					}

					if (perPageNum != null && perPageNum.equals("1")) {
						cont = request.getParameter("cont");
						mv.addObject("cbCont", perPageNum);
					}
				}
			} else {
				searchType = "2";
				startDateStr = shortSf.format(now) + "-01";
				endDateStr = sf.format(now);
				startDate = sf.parse(startDateStr);
				endDate = sf.parse(EncCommonHelper.getNextDateStr(endDateStr,
						"yyyy-MM-dd"));
				if (allowStart != null && allowStart.after(startDate)) {
					startDate = allowStart;
				}

				mv.addObject("startDate", startDateStr);
				mv.addObject("endDate", endDateStr);
			}

			List arg31 = this.outputDao.getOvBusiListCount(startDate, endDate,
					bbCode, cont, depId, staId, selfOutput, tsId, ub);
			BigDecimal arg32 = new BigDecimal(0);
			BigDecimal arg33 = new BigDecimal(0);
			int arg34 = 0;

			for (int arg35 = 0; arg35 < arg31.size(); ++arg35) {
				Object[] arg36 = (Object[]) arg31.get(arg35);
				if (arg36 != null) {
					if (arg36[0] != null) {
						arg34 = (new Integer(arg36[0].toString())).intValue();
					}

					if (arg36[1] != null) {
						arg32 = ((BigDecimal) arg36[1]).setScale(2, 4);
					}

					if (arg36[2] != null) {
						arg33 = (BigDecimal) arg36[2];
					}
				}
			}

			contentType = request.getParameter("content_type");
			if (contentType != null && contentType.equals("EXCEL")) {
				List arg38 = this.outputDao.getOvBusiList(startDate, endDate,
						bbCode, cont, depId, staId, selfOutput, tsId, ub, 0,
						arg34);
				OvBusinessListExcelView arg39 = new OvBusinessListExcelView();
				HashMap arg40 = new HashMap();
				arg40.put("list", arg38);
				arg40.put("ovCost", arg32);
				arg40.put("bbCost", arg33);
				return new ModelAndView(arg39, arg40);
			} else {
				int arg37 = EncCommonHelper.getPageSize(request);
				int pageno = EncCommonHelper.getCurrentPageIndex(request,
						arg34, arg37);
				int startIndex = (pageno - 1) * arg37;
				List list = this.outputDao.getOvBusiList(startDate, endDate,
						bbCode, cont, depId, staId, selfOutput, tsId, ub,
						startIndex, arg37);
				mv.addObject("qr", EncCommonHelper.parseQueryResult(list,
						arg34, arg37, pageno));
				mv.addObject("ovCost", arg32);
				mv.addObject("bbCost", arg33);
				mv.addObject("searchType", searchType);
				mv.addObject("depList", this.departmentDao.getList(true));
				mv.addObject("tsList",
						PageHelper.getTallySetList(this.tallySetDao, ub));
				return mv;
			}
		}
	}

	public ModelAndView handleOvFollList(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "OV_FOLL")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.ovFollListView);
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			boolean selfOutput = false;
			if (EncCommonHelper.checkPurePrivilege(request, "OUTP_SELF")) {
				selfOutput = true;
			}

			Date allowStart = null;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
				allowStart = EncCommonHelper.getEarlDataDate(request);
			}

			String startDateStr = "";
			String endDateStr = "";
			String bbCode = "";
			String cont = "";
			long depId = 0L;
			long tsId = 0L;
			long staId = 0L;
			Date startDate = null;
			Date endDate = null;
			mv.addObject("startDate", request.getParameter("start_date"));
			mv.addObject("endDate", request.getParameter("end_date"));
			mv.addObject("depId", request.getParameter("dep_id"));
			mv.addObject("staName", request.getParameter("sta_name"));
			mv.addObject("staId", request.getParameter("sta_id"));
			mv.addObject("tsId", request.getParameter("ts_id"));
			mv.addObject("bbCode", request.getParameter("bb_code"));
			mv.addObject("cont", request.getParameter("cont"));
			Date now = new Date();
			SimpleDateFormat shortSf = new SimpleDateFormat("yyyy-MM");
			SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
			String searchType = request.getParameter("search_type");
			String contentType;
			if (searchType != null && !searchType.equals("")) {
				if (searchType.equals("2")) {
					startDateStr = request.getParameter("start_date");
					endDateStr = request.getParameter("end_date");
					startDate = sf.parse(startDateStr);
					if (allowStart != null && allowStart.after(startDate)) {
						startDate = allowStart;
					}

					endDate = sf.parse(EncCommonHelper.getNextDateStr(
							endDateStr, "yyyy-MM-dd"));
				} else {
					String cl = request.getParameter("cb_date");
					String ovCost = request.getParameter("cb_sta");
					String bbCost = request.getParameter("cb_dep");
					String total = request.getParameter("cb_ts");
					contentType = request.getParameter("cb_bb_code");
					String perPageNum = request.getParameter("cb_cont");
					if (bbCost != null && bbCost.equals("1")) {
						depId = Long.parseLong(request.getParameter("dep_id"));
						mv.addObject("cbDep", bbCost);
					}

					if (total != null && total.equals("1")) {
						tsId = Long.parseLong(request.getParameter("ts_id"));
						mv.addObject("cbTs", total);
					}

					if (cl != null && cl.equals("1")) {
						startDateStr = request.getParameter("start_date");
						endDateStr = request.getParameter("end_date");
						startDate = sf.parse(startDateStr);
						if (allowStart != null && allowStart.after(startDate)) {
							startDate = allowStart;
						}

						endDate = sf.parse(EncCommonHelper.getNextDateStr(
								endDateStr, "yyyy-MM-dd"));
						mv.addObject("cbDate", cl);
					} else {
						startDate = allowStart;
					}

					if (ovCost != null && ovCost.equals("1")) {
						staId = Long.parseLong(request.getParameter("sta_id"));
						mv.addObject("cbSta", ovCost);
					}

					if (contentType != null && contentType.equals("1")) {
						bbCode = request.getParameter("bb_code");
						mv.addObject("cbBbCode", contentType);
					}

					if (perPageNum != null && perPageNum.equals("1")) {
						cont = request.getParameter("cont");
						mv.addObject("cbCont", perPageNum);
					}
				}
			} else {
				searchType = "2";
				startDateStr = shortSf.format(now) + "-01";
				endDateStr = sf.format(now);
				startDate = sf.parse(startDateStr);
				endDate = sf.parse(EncCommonHelper.getNextDateStr(endDateStr,
						"yyyy-MM-dd"));
				if (allowStart != null && allowStart.after(startDate)) {
					startDate = allowStart;
				}

				mv.addObject("startDate", startDateStr);
				mv.addObject("endDate", endDateStr);
			}

			List arg31 = this.outputDao.getOvFollListCount(startDate, endDate,
					bbCode, cont, depId, staId, selfOutput, tsId, ub);
			BigDecimal arg32 = new BigDecimal(0);
			BigDecimal arg33 = new BigDecimal(0);
			int arg34 = 0;

			for (int arg35 = 0; arg35 < arg31.size(); ++arg35) {
				Object[] arg36 = (Object[]) arg31.get(arg35);
				if (arg36 != null) {
					if (arg36[0] != null) {
						arg34 = (new Integer(arg36[0].toString())).intValue();
					}

					if (arg36[1] != null) {
						arg32 = ((BigDecimal) arg36[1]).setScale(2, 4);
					}

					if (arg36[2] != null) {
						arg33 = (BigDecimal) arg36[2];
					}
				}
			}

			contentType = request.getParameter("content_type");
			if (contentType != null && contentType.equals("EXCEL")) {
				List arg38 = this.outputDao.getOvFollList(startDate, endDate,
						bbCode, cont, depId, staId, selfOutput, tsId, ub, 0,
						arg34);
				OvFollowListExcelView arg39 = new OvFollowListExcelView();
				HashMap arg40 = new HashMap();
				arg40.put("list", arg38);
				arg40.put("ovCost", arg32);
				arg40.put("bbCost", arg33);
				return new ModelAndView(arg39, arg40);
			} else {
				int arg37 = EncCommonHelper.getPageSize(request);
				int pageno = EncCommonHelper.getCurrentPageIndex(request,
						arg34, arg37);
				int startIndex = (pageno - 1) * arg37;
				List list = this.outputDao.getOvFollList(startDate, endDate,
						bbCode, cont, depId, staId, selfOutput, tsId, ub,
						startIndex, arg37);
				mv.addObject("qr", EncCommonHelper.parseQueryResult(list,
						arg34, arg37, pageno));
				mv.addObject("ovCost", arg32);
				mv.addObject("bbCost", arg33);
				mv.addObject("searchType", searchType);
				mv.addObject("depList", this.departmentDao.getList(true));
				mv.addObject("tsList",
						PageHelper.getTallySetList(this.tallySetDao, ub));
				return mv;
			}
		}
	}

	public ModelAndView handleOvSaleList(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "OV_SALE")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.ovSaleListView);
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			boolean selfOutput = false;
			if (EncCommonHelper.checkPurePrivilege(request, "OUTP_SELF")) {
				selfOutput = true;
			}

			Date allowStart = null;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
				allowStart = EncCommonHelper.getEarlDataDate(request);
			}

			String startDateStr = "";
			String endDateStr = "";
			String bbCode = "";
			String cont = "";
			long depId = 0L;
			long tsId = 0L;
			long staId = 0L;
			Date startDate = null;
			Date endDate = null;
			mv.addObject("startDate", request.getParameter("start_date"));
			mv.addObject("endDate", request.getParameter("end_date"));
			mv.addObject("depId", request.getParameter("dep_id"));
			mv.addObject("staName", request.getParameter("sta_name"));
			mv.addObject("staId", request.getParameter("sta_id"));
			mv.addObject("tsId", request.getParameter("ts_id"));
			mv.addObject("cont", request.getParameter("cont"));
			mv.addObject("bbCode", request.getParameter("bb_code"));
			Date now = new Date();
			SimpleDateFormat shortSf = new SimpleDateFormat("yyyy-MM");
			SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
			String searchType = request.getParameter("search_type");
			String contentType;
			if (searchType != null && !searchType.equals("")) {
				if (searchType.equals("2")) {
					startDateStr = request.getParameter("start_date");
					endDateStr = request.getParameter("end_date");
					startDate = sf.parse(startDateStr);
					if (allowStart != null && allowStart.after(startDate)) {
						startDate = allowStart;
					}

					endDate = sf.parse(EncCommonHelper.getNextDateStr(
							endDateStr, "yyyy-MM-dd"));
				} else {
					String cl = request.getParameter("cb_date");
					String ovCost = request.getParameter("cb_sta");
					String total = request.getParameter("cb_dep");
					contentType = request.getParameter("cb_ts");
					String perPageNum = request.getParameter("cb_bb_code");
					String pageno = request.getParameter("cb_cont");
					if (total != null && total.equals("1")) {
						depId = Long.parseLong(request.getParameter("dep_id"));
						mv.addObject("cbDep", total);
					}

					if (contentType != null && contentType.equals("1")) {
						tsId = Long.parseLong(request.getParameter("ts_id"));
						mv.addObject("cbTs", contentType);
					}

					if (cl != null && cl.equals("1")) {
						startDateStr = request.getParameter("start_date");
						endDateStr = request.getParameter("end_date");
						startDate = sf.parse(startDateStr);
						if (allowStart != null && allowStart.after(startDate)) {
							startDate = allowStart;
						}

						endDate = sf.parse(EncCommonHelper.getNextDateStr(
								endDateStr, "yyyy-MM-dd"));
						mv.addObject("cbDate", cl);
					} else {
						startDate = allowStart;
					}

					if (ovCost != null && ovCost.equals("1")) {
						staId = Long.parseLong(request.getParameter("sta_id"));
						mv.addObject("cbSta", ovCost);
					}

					if (perPageNum != null && perPageNum.equals("1")) {
						bbCode = request.getParameter("bb_code");
						mv.addObject("cbBbCode", perPageNum);
					}

					if (pageno != null && pageno.equals("1")) {
						cont = request.getParameter("cont");
						mv.addObject("cbCont", pageno);
					}
				}
			} else {
				searchType = "2";
				startDateStr = shortSf.format(now) + "-01";
				endDateStr = sf.format(now);
				startDate = sf.parse(startDateStr);
				endDate = sf.parse(EncCommonHelper.getNextDateStr(endDateStr,
						"yyyy-MM-dd"));
				if (allowStart != null && allowStart.after(startDate)) {
					startDate = allowStart;
				}

				mv.addObject("startDate", startDateStr);
				mv.addObject("endDate", endDateStr);
			}

			List arg30 = this.outputDao.getOvSaleListCount(startDate, endDate,
					bbCode, cont, depId, staId, selfOutput, tsId, ub);
			BigDecimal arg31 = new BigDecimal(0);
			int arg32 = 0;

			for (int arg33 = 0; arg33 < arg30.size(); ++arg33) {
				Object[] arg34 = (Object[]) arg30.get(arg33);
				if (arg34 != null) {
					if (arg34[0] != null) {
						arg32 = (new Integer(arg34[0].toString())).intValue();
					}

					if (arg34[1] != null) {
						arg31 = ((BigDecimal) arg34[1]).setScale(2, 4);
					}
				}
			}

			contentType = request.getParameter("content_type");
			if (contentType != null && contentType.equals("EXCEL")) {
				List arg36 = this.outputDao.getOvSaleList(startDate, endDate,
						bbCode, cont, depId, staId, selfOutput, tsId, ub, 0,
						arg32);
				OvSaleListExcelView arg38 = new OvSaleListExcelView();
				HashMap arg39 = new HashMap();
				arg39.put("list", arg36);
				arg39.put("ovCost", arg31);
				return new ModelAndView(arg38, arg39);
			} else {
				int arg35 = EncCommonHelper.getPageSize(request);
				int arg37 = EncCommonHelper.getCurrentPageIndex(request, arg32,
						arg35);
				int startIndex = (arg37 - 1) * arg35;
				List list = this.outputDao.getOvSaleList(startDate, endDate,
						bbCode, cont, depId, staId, selfOutput, tsId, ub,
						startIndex, arg35);
				mv.addObject("qr", EncCommonHelper.parseQueryResult(list,
						arg32, arg35, arg37));
				mv.addObject("ovCost", arg31);
				mv.addObject("searchType", searchType);
				mv.addObject("depList", this.departmentDao.getList(true));
				mv.addObject("tsList",
						PageHelper.getTallySetList(this.tallySetDao, ub));
				return mv;
			}
		}
	}

	public ModelAndView handleOvReceList(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "OV_RECE")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.ovReceListView);
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			boolean selfOutput = false;
			if (EncCommonHelper.checkPurePrivilege(request, "OUTP_SELF")) {
				selfOutput = true;
			}

			Date allowStart = null;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
				allowStart = EncCommonHelper.getEarlDataDate(request);
			}

			String startDateStr = "";
			String endDateStr = "";
			String bbCode = "";
			String cont = "";
			long depId = 0L;
			long tsId = 0L;
			long staId = 0L;
			Date startDate = null;
			Date endDate = null;
			mv.addObject("startDate", request.getParameter("start_date"));
			mv.addObject("endDate", request.getParameter("end_date"));
			mv.addObject("depId", request.getParameter("dep_id"));
			mv.addObject("staName", request.getParameter("sta_name"));
			mv.addObject("staId", request.getParameter("sta_id"));
			mv.addObject("tsId", request.getParameter("ts_id"));
			mv.addObject("cont", request.getParameter("cont"));
			mv.addObject("bbCode", request.getParameter("bb_code"));
			Date now = new Date();
			SimpleDateFormat shortSf = new SimpleDateFormat("yyyy-MM");
			SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
			String searchType = request.getParameter("search_type");
			String contentType;
			if (searchType != null && !searchType.equals("")) {
				if (searchType.equals("2")) {
					startDateStr = request.getParameter("start_date");
					endDateStr = request.getParameter("end_date");
					startDate = sf.parse(startDateStr);
					if (allowStart != null && allowStart.after(startDate)) {
						startDate = allowStart;
					}

					endDate = sf.parse(EncCommonHelper.getNextDateStr(
							endDateStr, "yyyy-MM-dd"));
				} else {
					String cl = request.getParameter("cb_date");
					String ovCost = request.getParameter("cb_sta");
					String receCost = request.getParameter("cb_dep");
					String total = request.getParameter("cb_ts");
					contentType = request.getParameter("cb_bb_code");
					String perPageNum = request.getParameter("cb_cont");
					if (receCost != null && receCost.equals("1")) {
						depId = Long.parseLong(request.getParameter("dep_id"));
						mv.addObject("cbDep", receCost);
					}

					if (total != null && total.equals("1")) {
						tsId = Long.parseLong(request.getParameter("ts_id"));
						mv.addObject("cbTs", total);
					}

					if (cl != null && cl.equals("1")) {
						startDateStr = request.getParameter("start_date");
						endDateStr = request.getParameter("end_date");
						startDate = sf.parse(startDateStr);
						if (allowStart != null && allowStart.after(startDate)) {
							startDate = allowStart;
						}

						endDate = sf.parse(EncCommonHelper.getNextDateStr(
								endDateStr, "yyyy-MM-dd"));
						mv.addObject("cbDate", cl);
					} else {
						startDate = allowStart;
					}

					if (ovCost != null && ovCost.equals("1")) {
						staId = Long.parseLong(request.getParameter("sta_id"));
						mv.addObject("cbSta", ovCost);
					}

					if (contentType != null && contentType.equals("1")) {
						bbCode = request.getParameter("bb_code");
						mv.addObject("cbBbCode", contentType);
					}

					if (perPageNum != null && perPageNum.equals("1")) {
						cont = request.getParameter("cont");
						mv.addObject("cbCont", perPageNum);
					}
				}
			} else {
				searchType = "2";
				startDateStr = shortSf.format(now) + "-01";
				endDateStr = sf.format(now);
				startDate = sf.parse(startDateStr);
				endDate = sf.parse(EncCommonHelper.getNextDateStr(endDateStr,
						"yyyy-MM-dd"));
				if (allowStart != null && allowStart.after(startDate)) {
					startDate = allowStart;
				}

				mv.addObject("startDate", startDateStr);
				mv.addObject("endDate", endDateStr);
			}

			List arg31 = this.outputDao.getOvReceListCount(startDate, endDate,
					bbCode, cont, depId, staId, selfOutput, tsId, ub);
			BigDecimal arg32 = new BigDecimal(0);
			BigDecimal arg33 = new BigDecimal(0);
			int arg34 = 0;

			for (int arg35 = 0; arg35 < arg31.size(); ++arg35) {
				Object[] arg36 = (Object[]) arg31.get(arg35);
				if (arg36 != null) {
					if (arg36[0] != null) {
						arg34 = (new Integer(arg36[0].toString())).intValue();
					}

					if (arg36[1] != null) {
						arg32 = ((BigDecimal) arg36[1]).setScale(2, 4);
					}

					if (arg36[2] != null) {
						arg33 = (BigDecimal) arg36[2];
					}
				}
			}

			contentType = request.getParameter("content_type");
			if (contentType != null && contentType.equals("EXCEL")) {
				List arg38 = this.outputDao.getOvReceList(startDate, endDate,
						bbCode, cont, depId, staId, selfOutput, tsId, ub, 0,
						arg34);
				OvReceiveListExcelView arg39 = new OvReceiveListExcelView();
				HashMap arg40 = new HashMap();
				arg40.put("list", arg38);
				arg40.put("ovCost", arg32);
				arg40.put("receCost", arg33);
				return new ModelAndView(arg39, arg40);
			} else {
				int arg37 = EncCommonHelper.getPageSize(request);
				int pageno = EncCommonHelper.getCurrentPageIndex(request,
						arg34, arg37);
				int startIndex = (pageno - 1) * arg37;
				List list = this.outputDao.getOvReceList(startDate, endDate,
						bbCode, cont, depId, staId, selfOutput, tsId, ub,
						startIndex, arg37);
				mv.addObject("qr", EncCommonHelper.parseQueryResult(list,
						arg34, arg37, pageno));
				mv.addObject("ovCost", arg32);
				mv.addObject("receCost", arg33);
				mv.addObject("searchType", searchType);
				mv.addObject("depList", this.departmentDao.getList(true));
				mv.addObject("tsList",
						PageHelper.getTallySetList(this.tallySetDao, ub));
				return mv;
			}
		}
	}

	public ModelAndView handleOvDesiList(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "OV_DESI")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.ovDesiListView);
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			boolean selfOutput = false;
			if (EncCommonHelper.checkPurePrivilege(request, "OUTP_SELF")) {
				selfOutput = true;
			}

			Date allowStart = null;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
				allowStart = EncCommonHelper.getEarlDataDate(request);
			}

			String startDateStr = "";
			String endDateStr = "";
			String bbCode = "";
			String cont = "";
			long depId = 0L;
			long tsId = 0L;
			long staId = 0L;
			Date startDate = null;
			Date endDate = null;
			mv.addObject("startDate", request.getParameter("start_date"));
			mv.addObject("endDate", request.getParameter("end_date"));
			mv.addObject("depId", request.getParameter("dep_id"));
			mv.addObject("staName", request.getParameter("sta_name"));
			mv.addObject("staId", request.getParameter("sta_id"));
			mv.addObject("tsId", request.getParameter("ts_id"));
			mv.addObject("cont", request.getParameter("cont"));
			mv.addObject("bbCode", request.getParameter("bb_code"));
			Date now = new Date();
			SimpleDateFormat shortSf = new SimpleDateFormat("yyyy-MM");
			SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
			String searchType = request.getParameter("search_type");
			String contentType;
			if (searchType != null && !searchType.equals("")) {
				if (searchType.equals("2")) {
					startDateStr = request.getParameter("start_date");
					endDateStr = request.getParameter("end_date");
					startDate = sf.parse(startDateStr);
					if (allowStart != null && allowStart.after(startDate)) {
						startDate = allowStart;
					}

					endDate = sf.parse(EncCommonHelper.getNextDateStr(
							endDateStr, "yyyy-MM-dd"));
				} else {
					String cl = request.getParameter("cb_date");
					String ovCost = request.getParameter("cb_sta");
					String bbCost = request.getParameter("cb_dep");
					String total = request.getParameter("cb_ts");
					contentType = request.getParameter("cb_bb_code");
					String perPageNum = request.getParameter("cb_cont");
					if (bbCost != null && bbCost.equals("1")) {
						depId = Long.parseLong(request.getParameter("dep_id"));
						mv.addObject("cbDep", bbCost);
					}

					if (total != null && total.equals("1")) {
						tsId = Long.parseLong(request.getParameter("ts_id"));
						mv.addObject("cbTs", total);
					}

					if (cl != null && cl.equals("1")) {
						startDateStr = request.getParameter("start_date");
						endDateStr = request.getParameter("end_date");
						startDate = sf.parse(startDateStr);
						if (allowStart != null && allowStart.after(startDate)) {
							startDate = allowStart;
						}

						endDate = sf.parse(EncCommonHelper.getNextDateStr(
								endDateStr, "yyyy-MM-dd"));
						mv.addObject("cbDate", cl);
					} else {
						startDate = allowStart;
					}

					if (ovCost != null && ovCost.equals("1")) {
						staId = Long.parseLong(request.getParameter("sta_id"));
						mv.addObject("cbSta", ovCost);
					}

					if (contentType != null && contentType.equals("1")) {
						bbCode = request.getParameter("bb_code");
						mv.addObject("cbBbCode", contentType);
					}

					if (perPageNum != null && perPageNum.equals("1")) {
						cont = request.getParameter("cont");
						mv.addObject("cbCont", perPageNum);
					}
				}
			} else {
				searchType = "2";
				startDateStr = shortSf.format(now) + "-01";
				endDateStr = sf.format(now);
				startDate = sf.parse(startDateStr);
				endDate = sf.parse(EncCommonHelper.getNextDateStr(endDateStr,
						"yyyy-MM-dd"));
				if (allowStart != null && allowStart.after(startDate)) {
					startDate = allowStart;
				}

				mv.addObject("startDate", startDateStr);
				mv.addObject("endDate", endDateStr);
			}

			List arg31 = this.outputDao.getOvDesiListCount(startDate, endDate,
					bbCode, cont, depId, staId, selfOutput, tsId, ub);
			BigDecimal arg32 = new BigDecimal(0);
			BigDecimal arg33 = new BigDecimal(0);
			int arg34 = 0;

			for (int arg35 = 0; arg35 < arg31.size(); ++arg35) {
				Object[] arg36 = (Object[]) arg31.get(arg35);
				if (arg36 != null) {
					if (arg36[0] != null) {
						arg34 = (new Integer(arg36[0].toString())).intValue();
					}

					if (arg36[1] != null) {
						arg32 = ((BigDecimal) arg36[1]).setScale(2, 4);
					}

					if (arg36[2] != null) {
						arg33 = (BigDecimal) arg36[2];
					}
				}
			}

			contentType = request.getParameter("content_type");
			if (contentType != null && contentType.equals("EXCEL")) {
				List arg38 = this.outputDao.getOvDesiList(startDate, endDate,
						bbCode, cont, depId, staId, selfOutput, tsId, ub, 0,
						arg34);
				OvDesignListExcelView arg39 = new OvDesignListExcelView();
				HashMap arg40 = new HashMap();
				arg40.put("list", arg38);
				arg40.put("ovCost", arg32);
				arg40.put("bbCost", arg33);
				return new ModelAndView(arg39, arg40);
			} else {
				int arg37 = EncCommonHelper.getPageSize(request);
				int pageno = EncCommonHelper.getCurrentPageIndex(request,
						arg34, arg37);
				int startIndex = (pageno - 1) * arg37;
				List list = this.outputDao.getOvDesiList(startDate, endDate,
						bbCode, cont, depId, staId, selfOutput, tsId, ub,
						startIndex, arg37);
				mv.addObject("qr", EncCommonHelper.parseQueryResult(list,
						arg34, arg37, pageno));
				mv.addObject("ovCost", arg32);
				mv.addObject("bbCost", arg33);
				mv.addObject("searchType", searchType);
				mv.addObject("depList", this.departmentDao.getList(true));
				mv.addObject("tsList",
						PageHelper.getTallySetList(this.tallySetDao, ub));
				return mv;
			}
		}
	}

	public ModelAndView handleOvSetuList(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "OV_SETU")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.ovSetuListView);
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			boolean selfOutput = false;
			if (EncCommonHelper.checkPurePrivilege(request, "OUTP_SELF")) {
				selfOutput = true;
			}

			Date allowStart = null;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
				allowStart = EncCommonHelper.getEarlDataDate(request);
			}

			String startDateStr = "";
			String endDateStr = "";
			String cont = "";
			String bbCode = "";
			String billCode = "";
			long depId = 0L;
			long tsId = 0L;
			long staId = 0L;
			Date startDate = null;
			Date endDate = null;
			mv.addObject("startDate", request.getParameter("start_date"));
			mv.addObject("endDate", request.getParameter("end_date"));
			mv.addObject("depId", request.getParameter("dep_id"));
			mv.addObject("staName", request.getParameter("sta_name"));
			mv.addObject("staId", request.getParameter("sta_id"));
			mv.addObject("cont", request.getParameter("cont"));
			mv.addObject("bbCode", request.getParameter("bb_code"));
			mv.addObject("billCode", request.getParameter("bill_code"));
			mv.addObject("tsId", request.getParameter("ts_id"));
			Date now = new Date();
			SimpleDateFormat shortSf = new SimpleDateFormat("yyyy-MM");
			SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
			String searchType = request.getParameter("search_type");
			String contentType;
			if (searchType != null && !searchType.equals("")) {
				if (searchType.equals("2")) {
					startDateStr = request.getParameter("start_date");
					endDateStr = request.getParameter("end_date");
					startDate = sf.parse(startDateStr);
					if (allowStart != null && allowStart.after(startDate)) {
						startDate = allowStart;
					}

					endDate = sf.parse(EncCommonHelper.getNextDateStr(
							endDateStr, "yyyy-MM-dd"));
				} else {
					String cl = request.getParameter("cb_date");
					String ovCost = request.getParameter("cb_sta");
					String setuCost = request.getParameter("cb_bb_code");
					String total = request.getParameter("cb_bill_code");
					contentType = request.getParameter("cb_cont");
					String perPageNum = request.getParameter("cb_dep");
					String pageno = request.getParameter("cb_ts");
					if (perPageNum != null && perPageNum.equals("1")) {
						depId = Long.parseLong(request.getParameter("dep_id"));
						mv.addObject("cbDep", perPageNum);
					}

					if (pageno != null && pageno.equals("1")) {
						tsId = Long.parseLong(request.getParameter("ts_id"));
						mv.addObject("cbTs", pageno);
					}

					if (cl != null && cl.equals("1")) {
						startDateStr = request.getParameter("start_date");
						endDateStr = request.getParameter("end_date");
						startDate = sf.parse(startDateStr);
						if (allowStart != null && allowStart.after(startDate)) {
							startDate = allowStart;
						}

						endDate = sf.parse(EncCommonHelper.getNextDateStr(
								endDateStr, "yyyy-MM-dd"));
						mv.addObject("cbDate", cl);
					} else {
						startDate = allowStart;
					}

					if (ovCost != null && ovCost.equals("1")) {
						staId = Long.parseLong(request.getParameter("sta_id"));
						mv.addObject("cbSta", ovCost);
					}

					if (setuCost != null && setuCost.equals("1")) {
						bbCode = request.getParameter("bb_code");
						mv.addObject("cbBbCode", setuCost);
					}

					if (total != null && total.equals("1")) {
						billCode = request.getParameter("bill_code");
						mv.addObject("cbBillCode", total);
					}

					if (contentType != null && contentType.equals("1")) {
						cont = request.getParameter("cont");
						mv.addObject("cbCont", contentType);
					}
				}
			} else {
				searchType = "2";
				startDateStr = shortSf.format(now) + "-01";
				endDateStr = sf.format(now);
				startDate = sf.parse(startDateStr);
				endDate = sf.parse(EncCommonHelper.getNextDateStr(endDateStr,
						"yyyy-MM-dd"));
				if (allowStart != null && allowStart.after(startDate)) {
					startDate = allowStart;
				}

				mv.addObject("startDate", startDateStr);
				mv.addObject("endDate", endDateStr);
			}

			List arg32 = this.outputDao.getOvSetuListCount(startDate, endDate,
					bbCode, cont, billCode, depId, staId, selfOutput, tsId, ub);
			BigDecimal arg33 = new BigDecimal(0);
			BigDecimal arg34 = new BigDecimal(0);
			int arg35 = 0;

			for (int arg36 = 0; arg36 < arg32.size(); ++arg36) {
				Object[] arg37 = (Object[]) arg32.get(arg36);
				if (arg37 != null) {
					if (arg37[0] != null) {
						arg35 = (new Integer(arg37[0].toString())).intValue();
					}

					if (arg37[1] != null) {
						arg33 = ((BigDecimal) arg37[1]).setScale(2, 4);
					}

					if (arg37[2] != null) {
						arg34 = (BigDecimal) arg37[2];
					}
				}
			}

			contentType = request.getParameter("content_type");
			if (contentType != null && contentType.equals("EXCEL")) {
				List arg39 = this.outputDao.getOvSetuList(startDate, endDate,
						bbCode, cont, billCode, depId, staId, selfOutput, tsId,
						ub, 0, arg35);
				OvSetuListExcelView arg41 = new OvSetuListExcelView();
				HashMap arg42 = new HashMap();
				arg42.put("list", arg39);
				arg42.put("ovCost", arg33);
				arg42.put("setuCost", arg34);
				return new ModelAndView(arg41, arg42);
			} else {
				int arg38 = EncCommonHelper.getPageSize(request);
				int arg40 = EncCommonHelper.getCurrentPageIndex(request, arg35,
						arg38);
				int startIndex = (arg40 - 1) * arg38;
				List list = this.outputDao.getOvSetuList(startDate, endDate,
						bbCode, cont, billCode, depId, staId, selfOutput, tsId,
						ub, startIndex, arg38);
				mv.addObject("qr", EncCommonHelper.parseQueryResult(list,
						arg35, arg38, arg40));
				mv.addObject("ovCost", arg33);
				mv.addObject("setuCost", arg34);
				mv.addObject("searchType", searchType);
				mv.addObject("depList", this.departmentDao.getList(true));
				mv.addObject("tsList",
						PageHelper.getTallySetList(this.tallySetDao, ub));
				return mv;
			}
		}
	}

	public ModelAndView handleOvMakeList(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "OV_MAKE")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.ovMakeListView);
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			boolean selfOutput = false;
			if (EncCommonHelper.checkPurePrivilege(request, "OUTP_SELF")) {
				selfOutput = true;
			}

			Date allowStart = null;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
				allowStart = EncCommonHelper.getEarlDataDate(request);
			}

			String startDateStr = "";
			String endDateStr = "";
			String bbCode = "";
			String cont = "";
			String mr = "";
			long depId = 0L;
			long tsId = 0L;
			long wcId = 0L;
			long staId = 0L;
			Date startDate = null;
			Date endDate = null;
			mv.addObject("startDate", request.getParameter("start_date"));
			mv.addObject("endDate", request.getParameter("end_date"));
			mv.addObject("depId", request.getParameter("dep_id"));
			mv.addObject("staName", request.getParameter("sta_name"));
			mv.addObject("staId", request.getParameter("sta_id"));
			mv.addObject("tsId", request.getParameter("ts_id"));
			mv.addObject("cont", request.getParameter("cont"));
			mv.addObject("mr", request.getParameter("mr"));
			mv.addObject("bbCode", request.getParameter("bb_code"));
			mv.addObject("wcId", request.getParameter("wc_id"));
			Date now = new Date();
			SimpleDateFormat shortSf = new SimpleDateFormat("yyyy-MM");
			SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
			String searchType = request.getParameter("search_type");
			String contentType;
			if (searchType != null && !searchType.equals("")) {
				if (searchType.equals("2")) {
					startDateStr = request.getParameter("start_date");
					endDateStr = request.getParameter("end_date");
					startDate = sf.parse(startDateStr);
					if (allowStart != null && allowStart.after(startDate)) {
						startDate = allowStart;
					}

					endDate = sf.parse(EncCommonHelper.getNextDateStr(
							endDateStr, "yyyy-MM-dd"));
				} else {
					String cl = request.getParameter("cb_date");
					String ovCost = request.getParameter("cb_sta");
					String bbCost = request.getParameter("cb_dep");
					String total = request.getParameter("cb_ts");
					contentType = request.getParameter("cb_bb_code");
					String perPageNum = request.getParameter("cb_cont");
					String pageno = request.getParameter("cb_mr");
					String startIndex = request.getParameter("cb_wc");
					if (bbCost != null && bbCost.equals("1")) {
						depId = Long.parseLong(request.getParameter("dep_id"));
						mv.addObject("cbDep", bbCost);
					}

					if (total != null && total.equals("1")) {
						tsId = Long.parseLong(request.getParameter("ts_id"));
						mv.addObject("cbTs", total);
					}

					if (cl != null && cl.equals("1")) {
						startDateStr = request.getParameter("start_date");
						endDateStr = request.getParameter("end_date");
						startDate = sf.parse(startDateStr);
						if (allowStart != null && allowStart.after(startDate)) {
							startDate = allowStart;
						}

						endDate = sf.parse(EncCommonHelper.getNextDateStr(
								endDateStr, "yyyy-MM-dd"));
						mv.addObject("cbDate", cl);
					} else {
						startDate = allowStart;
					}

					if (ovCost != null && ovCost.equals("1")) {
						staId = Long.parseLong(request.getParameter("sta_id"));
						mv.addObject("cbSta", ovCost);
					}

					if (contentType != null && contentType.equals("1")) {
						bbCode = request.getParameter("bb_code");
						mv.addObject("cbBbCode", contentType);
					}

					if (perPageNum != null && perPageNum.equals("1")) {
						cont = request.getParameter("cont");
						mv.addObject("cbCont", perPageNum);
					}

					if (pageno != null && pageno.equals("1")) {
						mr = request.getParameter("mr");
						mv.addObject("cbMr", pageno);
					}

					if (startIndex != null && startIndex.equals("1")) {
						wcId = Long.parseLong(request.getParameter("wc_id"));
						mv.addObject("cbWc", startIndex);
					}
				}
			} else {
				searchType = "2";
				startDateStr = shortSf.format(now) + "-01";
				endDateStr = sf.format(now);
				startDate = sf.parse(startDateStr);
				endDate = sf.parse(EncCommonHelper.getNextDateStr(endDateStr,
						"yyyy-MM-dd"));
				if (allowStart != null && allowStart.after(startDate)) {
					startDate = allowStart;
				}

				mv.addObject("startDate", startDateStr);
				mv.addObject("endDate", endDateStr);
			}

			List arg35 = this.outputDao.getOvMakeListCount(startDate, endDate,
					bbCode, cont, mr, depId, wcId, staId, selfOutput, tsId, ub);
			BigDecimal arg36 = new BigDecimal(0);
			BigDecimal arg37 = new BigDecimal(0);
			int arg38 = 0;

			for (int arg39 = 0; arg39 < arg35.size(); ++arg39) {
				Object[] arg40 = (Object[]) arg35.get(arg39);
				if (arg40 != null) {
					if (arg40[0] != null) {
						arg38 = (new Integer(arg40[0].toString())).intValue();
					}

					if (arg40[1] != null) {
						arg36 = ((BigDecimal) arg40[1]).setScale(2, 4);
					}

					if (arg40[2] != null) {
						arg37 = (BigDecimal) arg40[2];
					}
				}
			}

			contentType = request.getParameter("content_type");
			if (contentType != null && contentType.equals("EXCEL")) {
				List arg42 = this.outputDao.getOvMakeList(startDate, endDate,
						bbCode, cont, mr, depId, wcId, staId, selfOutput, tsId,
						ub, 0, arg38);
				OvMakeListExcelView arg44 = new OvMakeListExcelView();
				HashMap arg46 = new HashMap();
				arg46.put("list", arg42);
				arg46.put("ovCost", arg36);
				arg46.put("bbCost", arg37);
				arg46.put("mtList", this.makeTypeDao.getList(false));
				arg46.put("wcList", this.workCenterDao.getList(false));
				arg46.put("proList", this.workProcessDao.getList(0L, false));
				return new ModelAndView(arg44, arg46);
			} else {
				int arg41 = EncCommonHelper.getPageSize(request);
				int arg43 = EncCommonHelper.getCurrentPageIndex(request, arg38,
						arg41);
				int arg45 = (arg43 - 1) * arg41;
				List list = this.outputDao.getOvMakeList(startDate, endDate,
						bbCode, cont, mr, depId, wcId, staId, selfOutput, tsId,
						ub, arg45, arg41);
				mv.addObject("qr", EncCommonHelper.parseQueryResult(list,
						arg38, arg41, arg43));
				mv.addObject("ovCost", arg36);
				mv.addObject("bbCost", arg37);
				mv.addObject("searchType", searchType);
				mv.addObject("mtList", this.makeTypeDao.getList(false));
				mv.addObject("wcList", this.workCenterDao.getList(false));
				mv.addObject("proList", this.workProcessDao.getList(0L, false));
				EnterpriseInfo ent = EncCommonHelper.getEnterpriseInfo(request);
				mv.addObject("myWcList", PageHelper.getWorkCenterList(
						this.workCenterDao, ub, ent));
				mv.addObject("depList", this.departmentDao.getList(true));
				mv.addObject("tsList",
						PageHelper.getTallySetList(this.tallySetDao, ub));
				return mv;
			}
		}
	}

	public ModelAndView handleOvCount(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "OV_COUN")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.ovCountView);
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			boolean selfOutput = false;
			if (EncCommonHelper.checkPurePrivilege(request, "OUTP_SELF")) {
				selfOutput = true;
			}

			Date allowStart = null;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
				allowStart = EncCommonHelper.getEarlDataDate(request);
			}

			String staName = "";
			String startDateStr = "";
			String endDateStr = "";
			long depId = 0L;
			long tsId = 0L;
			Date startDate = null;
			Date endDate = null;
			mv.addObject("startDate", request.getParameter("start_date"));
			mv.addObject("endDate", request.getParameter("end_date"));
			mv.addObject("depId", request.getParameter("dep_id"));
			mv.addObject("staName", request.getParameter("sta_name"));
			mv.addObject("tsId", request.getParameter("ts_id"));
			Date now = new Date();
			SimpleDateFormat shortSf = new SimpleDateFormat("yyyy-MM");
			SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
			String searchType = request.getParameter("search_type");
			String searchTime = "";
			if (searchType != null && !searchType.equals("")) {
				if (searchType.equals("2")) {
					startDateStr = request.getParameter("start_date");
					endDateStr = request.getParameter("end_date");
					startDate = sf.parse(startDateStr);
					if (allowStart != null && allowStart.after(startDate)) {
						startDate = allowStart;
					}

					endDate = sf.parse(EncCommonHelper.getNextDateStr(
							endDateStr, "yyyy-MM-dd"));
					searchTime = startDateStr + " 至 " + endDateStr;
				} else {
					String totalArr = request.getParameter("cb_date");
					String stafferList = request.getParameter("cb_sta");
					String busiList = request.getParameter("cb_dep");
					String makeList = request.getParameter("cb_ts");
					if (busiList != null && busiList.equals("1")) {
						depId = Long.parseLong(request.getParameter("dep_id"));
						mv.addObject("cbDep", busiList);
					}

					if (makeList != null && makeList.equals("1")) {
						tsId = Long.parseLong(request.getParameter("ts_id"));
						mv.addObject("cbTs", makeList);
					}

					if (totalArr != null && totalArr.equals("1")) {
						startDateStr = request.getParameter("start_date");
						endDateStr = request.getParameter("end_date");
						startDate = sf.parse(startDateStr);
						if (allowStart != null && allowStart.after(startDate)) {
							startDate = allowStart;
						}

						endDate = sf.parse(EncCommonHelper.getNextDateStr(
								endDateStr, "yyyy-MM-dd"));
						mv.addObject("cbDate", totalArr);
						searchTime = startDateStr + " 至 " + endDateStr;
					} else {
						startDate = allowStart;
					}

					if (stafferList != null && stafferList.equals("1")) {
						staName = request.getParameter("sta_name");
						mv.addObject("cbSta", stafferList);
					}
				}
			} else {
				searchType = "2";
				startDateStr = shortSf.format(now) + "-01";
				endDateStr = sf.format(now);
				startDate = sf.parse(startDateStr);
				endDate = sf.parse(EncCommonHelper.getNextDateStr(endDateStr,
						"yyyy-MM-dd"));
				if (allowStart != null && allowStart.after(startDate)) {
					startDate = allowStart;
				}

				mv.addObject("startDate", startDateStr);
				mv.addObject("endDate", endDateStr);
				searchTime = startDateStr + " 至 " + endDateStr;
			}

			BigDecimal[] arg39 = new BigDecimal[]{new BigDecimal(0),
					new BigDecimal(0), new BigDecimal(0), new BigDecimal(0),
					new BigDecimal(0), new BigDecimal(0), new BigDecimal(0),
					new BigDecimal(0), new BigDecimal(0)};
			List arg40 = this.stafferDao.getList(depId, staName);
			List arg41 = this.outputDao.getBusinessOvCount(startDate, endDate,
					selfOutput, tsId, ub);
			List arg42 = this.outputDao.getMakeOvCount(startDate, endDate,
					selfOutput, tsId, ub);
			List receList = this.outputDao.getReceiveOvCount(startDate,
					endDate, selfOutput, tsId, ub);
			List desiList = this.outputDao.getDesignOvCount(startDate, endDate,
					selfOutput, tsId, ub);
			List follList = this.outputDao.getFollowOvCount(startDate, endDate,
					selfOutput, tsId, ub);
			List setuList = this.outputDao.getSetuOvCount(startDate, endDate,
					selfOutput, tsId, ub);
			List billList = this.outputDao.getOvBillCount(startDate, endDate,
					selfOutput, tsId, ub);
			ArrayList arr = new ArrayList();

			for (int objs = 0; objs < arg40.size(); ++objs) {
				Object[] contentType = (Object[]) arg40.get(objs);
				boolean v = false;
				Object[] map = new Object[13];
				map[0] = contentType[0];
				map[1] = contentType[3];
				map[2] = contentType[1];
				map[3] = contentType[2];

				int bean;
				Object[] tmpObjs;
				BigDecimal billOv;
				for (bean = 0; bean < arg41.size(); ++bean) {
					tmpObjs = (Object[]) arg41.get(bean);
					if (Long.parseLong(map[0].toString()) == Long
							.parseLong(tmpObjs[0].toString())) {
						billOv = ((BigDecimal) tmpObjs[1]).setScale(2, 4);
						BigDecimal saleOv = ((BigDecimal) tmpObjs[2]).setScale(
								2, 4);
						BigDecimal receOv = ((BigDecimal) tmpObjs[3]).setScale(
								2, 4);
						map[4] = billOv;
						if (map[8] == null) {
							map[8] = receOv;
						} else {
							map[8] = receOv.add((BigDecimal) map[8]);
						}

						if (map[11] == null) {
							map[11] = billOv.add(receOv);
						} else {
							map[11] = billOv.add(receOv).add(
									(BigDecimal) map[11]);
						}

						map[12] = saleOv;
						arg39[0] = arg39[0].add(billOv);
						arg39[4] = arg39[4].add(receOv);
						arg39[8] = arg39[8].add(saleOv);
						v = true;
						break;
					}
				}

				for (bean = 0; bean < receList.size(); ++bean) {
					tmpObjs = (Object[]) receList.get(bean);
					if (Long.parseLong(map[0].toString()) == Long
							.parseLong(tmpObjs[0].toString())) {
						billOv = ((BigDecimal) tmpObjs[1]).setScale(2, 4);
						if (map[8] == null) {
							map[8] = billOv;
						} else {
							map[8] = billOv.add((BigDecimal) map[8]);
						}

						if (map[11] == null) {
							map[11] = billOv;
						} else {
							map[11] = billOv.add((BigDecimal) map[11]);
						}

						arg39[4] = arg39[4].add(billOv);
						v = true;
						break;
					}
				}

				for (bean = 0; bean < arg42.size(); ++bean) {
					tmpObjs = (Object[]) arg42.get(bean);
					if (Long.parseLong(map[0].toString()) == Long
							.parseLong(tmpObjs[0].toString())) {
						billOv = ((BigDecimal) tmpObjs[1]).setScale(2, 4);
						map[7] = billOv;
						if (map[11] == null) {
							map[11] = billOv;
						} else {
							map[11] = billOv.add((BigDecimal) map[11]);
						}

						arg39[3] = arg39[3].add(billOv);
						v = true;
						break;
					}
				}

				for (bean = 0; bean < desiList.size(); ++bean) {
					tmpObjs = (Object[]) desiList.get(bean);
					if (Long.parseLong(map[0].toString()) == Long
							.parseLong(tmpObjs[0].toString())) {
						billOv = ((BigDecimal) tmpObjs[1]).setScale(2, 4);
						map[6] = billOv;
						if (map[11] == null) {
							map[11] = billOv;
						} else {
							map[11] = billOv.add((BigDecimal) map[11]);
						}

						arg39[2] = arg39[2].add(billOv);
						v = true;
						break;
					}
				}

				for (bean = 0; bean < follList.size(); ++bean) {
					tmpObjs = (Object[]) follList.get(bean);
					if (Long.parseLong(map[0].toString()) == Long
							.parseLong(tmpObjs[0].toString())) {
						billOv = ((BigDecimal) tmpObjs[1]).setScale(2, 4);
						map[5] = billOv;
						if (map[11] == null) {
							map[11] = billOv;
						} else {
							map[11] = billOv.add((BigDecimal) map[11]);
						}

						arg39[1] = arg39[1].add(billOv);
						v = true;
						break;
					}
				}

				for (bean = 0; bean < setuList.size(); ++bean) {
					tmpObjs = (Object[]) setuList.get(bean);
					if (Long.parseLong(map[0].toString()) == Long
							.parseLong(tmpObjs[0].toString())) {
						billOv = ((BigDecimal) tmpObjs[1]).setScale(2, 4);
						map[9] = billOv;
						if (map[11] == null) {
							map[11] = billOv;
						} else {
							map[11] = billOv.add((BigDecimal) map[11]);
						}

						arg39[5] = arg39[5].add(billOv);
						v = true;
						break;
					}
				}

				for (bean = 0; bean < billList.size(); ++bean) {
					tmpObjs = (Object[]) billList.get(bean);
					if (Long.parseLong(map[0].toString()) == Long
							.parseLong(tmpObjs[0].toString())) {
						billOv = (BigDecimal) tmpObjs[1];
						map[10] = billOv;
						if (map[11] == null) {
							map[11] = billOv;
						} else {
							map[11] = billOv.add((BigDecimal) map[11]);
						}

						arg39[6] = arg39[6].add(billOv);
						v = true;
						break;
					}
				}

				if (v) {
					OvCountBean arg47 = new OvCountBean();
					arg47.setValues(map);
					arg47.setOvTotal((BigDecimal) map[11]);
					arr.add(arg47);
				}
			}

			arg39[7] = arg39[0].add(arg39[1]).add(arg39[2]).add(arg39[3])
					.add(arg39[4]).add(arg39[5].add(arg39[6]));
			Object[] arg43 = arr.toArray();
			Arrays.sort(arg43, new OvCountBeanComparator());
			String arg44 = request.getParameter("content_type");
			if (arg44 != null && arg44.equals("EXCEL")) {
				OvCountExcelView arg46 = new OvCountExcelView();
				HashMap arg45 = new HashMap();
				arg45.put("list", arg43);
				arg45.put("totalArr", arg39);
				arg45.put("searchTime", searchTime);
				return new ModelAndView(arg46, arg45);
			} else {
				mv.addObject("list", arg43);
				mv.addObject("totalArr", arg39);
				mv.addObject("searchType", searchType);
				mv.addObject("depList", this.departmentDao.getList(true));
				mv.addObject("tsList",
						PageHelper.getTallySetList(this.tallySetDao, ub));
				return mv;
			}
		}
	}

	public String getOperateSuccessView() {
		return this.operateSuccessView;
	}

	public void setOperateSuccessView(String operateSuccessView) {
		this.operateSuccessView = operateSuccessView;
	}

	public IdGenerator getIdGenerator() {
		return this.idGenerator;
	}

	public void setIdGenerator(IdGenerator idGenerator) {
		this.idGenerator = idGenerator;
	}

	public String getOutputFormView() {
		return this.outputFormView;
	}

	public void setOutputFormView(String outputFormView) {
		this.outputFormView = outputFormView;
	}

	public OutputService getOutputService() {
		return this.outputService;
	}

	public void setOutputService(OutputService outputService) {
		this.outputService = outputService;
	}

	public String getSearchResultView() {
		return this.searchResultView;
	}

	public void setSearchResultView(String searchResultView) {
		this.searchResultView = searchResultView;
	}

	public QueryDao getQueryDao() {
		return this.queryDao;
	}

	public void setQueryDao(QueryDao queryDao) {
		this.queryDao = queryDao;
	}

	public TallySetDao getTallySetDao() {
		return this.tallySetDao;
	}

	public void setTallySetDao(TallySetDao tallySetDao) {
		this.tallySetDao = tallySetDao;
	}

	public WorkCenterDao getWorkCenterDao() {
		return this.workCenterDao;
	}

	public void setWorkCenterDao(WorkCenterDao workCenterDao) {
		this.workCenterDao = workCenterDao;
	}

	public MakeTypeDao getMakeTypeDao() {
		return this.makeTypeDao;
	}

	public void setMakeTypeDao(MakeTypeDao makeTypeDao) {
		this.makeTypeDao = makeTypeDao;
	}

	public String getCountView() {
		return this.countView;
	}

	public void setCountView(String countView) {
		this.countView = countView;
	}

	public WorkProcessDao getWorkProcessDao() {
		return this.workProcessDao;
	}

	public void setWorkProcessDao(WorkProcessDao workProcessDao) {
		this.workProcessDao = workProcessDao;
	}

	public OutputDao getOutputDao() {
		return this.outputDao;
	}

	public void setOutputDao(OutputDao outputDao) {
		this.outputDao = outputDao;
	}

	public EnterpriseInfoDao getEnterpriseInfoDao() {
		return this.enterpriseInfoDao;
	}

	public void setEnterpriseInfoDao(EnterpriseInfoDao enterpriseInfoDao) {
		this.enterpriseInfoDao = enterpriseInfoDao;
	}

	public String getSetOvPercentFormView() {
		return this.setOvPercentFormView;
	}

	public void setSetOvPercentFormView(String setOvPercentFormView) {
		this.setOvPercentFormView = setOvPercentFormView;
	}

	public DepartmentDao getDepartmentDao() {
		return this.departmentDao;
	}

	public void setDepartmentDao(DepartmentDao departmentDao) {
		this.departmentDao = departmentDao;
	}

	public StafferDao getStafferDao() {
		return this.stafferDao;
	}

	public void setStafferDao(StafferDao stafferDao) {
		this.stafferDao = stafferDao;
	}
}